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

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