[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH for-4.9] tools/xenconsoled: Preserve errno while rotating logfile handles



The logic to optionally exit after a poll() error relies on errno, but
handle_log_reload() does not preserve it.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CC: Wei Liu <wei.liu2@xxxxxxxxxx>
CC: Julien Grall <julien.grall@xxxxxxx>

For some reason which we haven't tracked down completely yet, an NTP time step
appears to reliably cause xenconsoled to exit, citing "Failure in poll
xs_handle: %d (%s)" with ENOENT.  The NTP time step almost certainly results
in log rotation, but I haven't identifed where the ENOENT came from.
---
 tools/console/daemon/io.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index 7e6a886..7e474bb 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -1117,8 +1117,12 @@ void handle_io(void)
                ret = poll(fds, nr_fds, next_timeout ? poll_timeout : -1);
 
                if (log_reload) {
+                       int saved_errno = errno;
+
                        handle_log_reload();
                        log_reload = 0;
+
+                       errno = saved_errno;
                }
 
                /* Abort if poll failed, except for EINTR cases
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.