[xen master] tools/xenconsoled: Preserve errno while rotating logfile handles

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen master] tools/xenconsoled: Preserve errno while rotating logfile handles

patchbot
commit a7d4a5904b62731551e366ff62d84759c8ee68e2
Author:     Andrew Cooper <[hidden email]>
AuthorDate: Tue May 16 14:57:27 2017 +0100
Commit:     Wei Liu <[hidden email]>
CommitDate: Wed May 17 17:15:07 2017 +0100

    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 <[hidden email]>
    Acked-by: Ian Jackson <[hidden email]>
    Acked-by: Wei Liu <[hidden email]>
    Release-acked-by: Julien Grall <[hidden email]>
---
 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
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog