Skip to contentSkip to conversation

tools/xenconsoled: Preserve errno while rotating logfile handles

PATCH In review Andrew Cooper 3 participants 3 messages May 16, 2017 – May 17, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Julien Grall <[email protected]>

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(+)
tools/console/daemon/io.c +4 -0
index 7e6a886..7e474bb 100644
@@ -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
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 1/1
#1 lore raw

Andrew Cooper writes ("[PATCH for-4.9] tools/xenconsoled: Preserve errno while rotating logfile handles"):

Quoted 4 lines

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

This is an obvious bugfix and good 4.9 material IMO.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 9 lines · Ian Jackson

Andrew Cooper writes ("[PATCH for-4.9] tools/xenconsoled: Preserve errno while rotating logfile handles"):

Quoted 4 lines

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

This is an obvious bugfix and good 4.9 material IMO.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel