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

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