From 08f0d9c2a99ba420c5b62f0318d51fafd2ab0e82 Mon Sep 17 00:00:00 2001
From: yann.lopez <yann.lopez@gmail.com>
Date: Mon, 31 May 2010 12:20:42 +0200
Subject: [PATCH] fix mountd CPU usage

---
 package/mountd/patches/001-fix-cpu.patch |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
 create mode 100644 package/mountd/patches/001-fix-cpu.patch

diff --git a/package/mountd/patches/001-fix-cpu.patch b/package/mountd/patches/001-fix-cpu.patch
new file mode 100644
index 0000000..ca06586
--- /dev/null
+++ b/package/mountd/patches/001-fix-cpu.patch
@@ -0,0 +1,25 @@
+diff -Naur mountd-0.1/lib/autofs.c mountd-0.2/lib/autofs.c
+--- mountd-0.1/lib/autofs.c	2009-10-02 23:54:53.000000000 +0200
++++ mountd-0.2/lib/autofs.c	2010-05-31 12:14:56.000000000 +0200
+@@ -147,15 +147,18 @@
+ 
+ 	while(1)
+ 	{
+-		if(poll(fds, 2, 1000) == -1)
++		int res = poll(fds, 1, -1);
++		if(res == -1)
+ 		{
+ 			if (errno == EINTR)
+ 				continue;
+ 			log_printf("failed while trying to read packet from kernel\n");
+ 			return -1;
+ 		}
+-		if(fds[0].revents & POLLIN)
+-			return fullread(pkt, sizeof(*pkt));
++		else if ( res > 0 ) {
++			if(fds[0].revents & POLLIN)
++				return fullread(pkt, sizeof(*pkt));
++		}
+ 	}
+ }
+ 
-- 
1.7.0.4

