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

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