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

[xen master] tools/xenstore: let tdb_logger() preserve errno



commit 6a0d1914f0b19742436367a0019602992573bd4b
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Wed Dec 14 12:01:47 2022 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Dec 14 12:01:47 2022 +0100

    tools/xenstore: let tdb_logger() preserve errno
    
    tdb_logger() is called by TDB for logging errors. As errno is checked
    often after doing the logging, tdb_logger() should preserve errno.
    
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>
---
 tools/xenstore/xenstored_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 476d5c6d51..4cd54c8b5a 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2347,6 +2347,7 @@ static void tdb_logger(TDB_CONTEXT *tdb, int level, const 
char * fmt, ...)
 {
        va_list ap;
        char *s;
+       int saved_errno = errno;
 
        va_start(ap, fmt);
        s = talloc_vasprintf(NULL, fmt, ap);
@@ -2362,6 +2363,8 @@ static void tdb_logger(TDB_CONTEXT *tdb, int level, const 
char * fmt, ...)
                trace("talloc failure during logging\n");
                syslog(LOG_ERR, "talloc failure during logging\n");
        }
+
+       errno = saved_errno;
 }
 
 void setup_structure(bool live_update)
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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