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

Re: [PATCH 04/20] tools/xenstore: let tdb_logger() preserve errno



Hi Juergen,

On 01/11/2022 15:28, Juergen Gross wrote:
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>

Cheers,

---
  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 5a174b9881..d48208ecfe 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2345,6 +2345,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);
@@ -2360,6 +2361,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)

--
Julien Grall



 


Rackspace

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