Blame SOURCES/autofs-5.1.1-log-pipe-read-errors.patch

304803
autofs-5.1.1 - log pipe read errors
304803
304803
From: Ian Kent <raven@themaw.net>
304803
304803
Log any unexpected pipe read (possible error) returns.
304803
304803
Signed-off-by: Ian Kent <raven@themaw.net>
304803
---
304803
 CHANGELOG          |    1 +
304803
 daemon/automount.c |   24 ++++++++++++++++++++----
304803
 2 files changed, 21 insertions(+), 4 deletions(-)
304803
304803
--- autofs-5.0.7.orig/CHANGELOG
304803
+++ autofs-5.0.7/CHANGELOG
304803
@@ -187,6 +187,7 @@
304803
 - gaurd against incorrect umount return.
304803
 - fix typo in autofs.conf.
304803
 - always set direct mounts catatonic at exit.
304803
+- log pipe read errors.
304803
 
304803
 25/07/2012 autofs-5.0.7
304803
 =======================
304803
--- autofs-5.0.7.orig/daemon/automount.c
304803
+++ autofs-5.0.7/daemon/automount.c
304803
@@ -968,6 +968,8 @@ static int get_pkt(struct autofs_point *
304803
 	struct pollfd fds[3];
304803
 	int pollfds = 3;
304803
 	char buf[MAX_ERR_BUF];
304803
+	size_t read;
304803
+	char *estr;
304803
 
304803
 	fds[0].fd = ap->pipefd;
304803
 	fds[0].events = POLLIN;
304803
@@ -980,7 +982,6 @@ static int get_pkt(struct autofs_point *
304803
 
304803
 	for (;;) {
304803
 		if (poll(fds, pollfds, -1) == -1) {
304803
-			char *estr;
304803
 			if (errno == EINTR)
304803
 				continue;
304803
 			estr = strerror_r(errno, buf, MAX_ERR_BUF);
304803
@@ -999,7 +1000,13 @@ static int get_pkt(struct autofs_point *
304803
 
304803
 			state_pipe = ap->state_pipe[0];
304803
 
304803
-			if (fullread(state_pipe, &next_state, read_size)) {
304803
+			read = fullread(state_pipe, &next_state, read_size);
304803
+			if (read) {
304803
+				estr = strerror_r(errno, buf, MAX_ERR_BUF);
304803
+				error(ap->logopt,
304803
+				      "read error on state pipe, "
304803
+				      "read %u, error %s",
304803
+				      read, estr);
304803
 				st_mutex_unlock();
304803
 				continue;
304803
 			}
304803
@@ -1010,8 +1017,17 @@ static int get_pkt(struct autofs_point *
304803
 				return -1;
304803
 		}
304803
 
304803
-		if (fds[0].revents & POLLIN)
304803
-			return fullread(ap->pipefd, pkt, kpkt_len);
304803
+		if (fds[0].revents & POLLIN) {
304803
+			read = fullread(ap->pipefd, pkt, kpkt_len);
304803
+			if (read) {
304803
+				estr = strerror_r(errno, buf, MAX_ERR_BUF);
304803
+				error(ap->logopt,
304803
+				      "read error on request pipe, "
304803
+				      "read %u, expected %u error %s",
304803
+				       read, kpkt_len, estr);
304803
+			}
304803
+			return read;
304803
+		}
304803
 
304803
 		if (fds[2].fd != -1 && fds[2].revents & POLLIN) {
304803
 			debug(ap->logopt, "message pending on control fifo.");