From 95b9dfe99df717050460ca263a56e245ff106b3a Mon Sep 17 00:00:00 2001
From: Mark Grondona <mgrondona@llnl.gov>
Date: Thu, 19 Sep 2002 20:55:38 +0000
Subject: [PATCH]  o use a getsockopt() to get and clear error condition in
 io.c    still needs work -- should we continue to use the socket    or close
 it?

---
 src/srun/io.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/srun/io.c b/src/srun/io.c
index eecc1eae3a3..6ce6adbdca4 100644
--- a/src/srun/io.c
+++ b/src/srun/io.c
@@ -164,8 +164,12 @@ _io_thr_poll(void *job_arg)
 			unsigned short revents = fds[i].revents;
 			xassert(!(revents & POLLNVAL));
 			if (revents & POLLERR || revents & POLLHUP) {
-				error("poll error condition on fd %d", 
-						fds[i].fd);
+				int err;
+				socklen_t size = sizeof(int);
+				getsockopt(fds[i].fd, SOL_SOCKET, 
+					   SO_ERROR, (void *)&err, &size);
+				error("poll error condition %d on fd %d", 
+						err, fds[i].fd);
 				_shutdown_fd_poll(&map[i]);
 			}
 
-- 
GitLab