isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit e295f483d975d7e926bb5a2527aeab10c150dd4c
parent 6e56f39fa9958d93b9ea9973dadaaa477ac452b2
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Fri,  1 Jan 2021 14:46:31 +0100

save errno in sys_error()

the print functions prior to perror() might otherwise clobber it.

Diffstat:
Msrc/util.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/util.c b/src/util.c @@ -27,6 +27,7 @@ #include <stdlib.h> #include <unistd.h> #include <fcntl.h> +#include <errno.h> #include <string.h> #include <ctype.h> #include <pwd.h> @@ -154,9 +155,11 @@ vsys_error( const char *msg, va_list va ) { char buf[1024]; + int errno_bak = errno; flushn(); if ((uint)vsnprintf( buf, sizeof(buf), msg, va ) >= sizeof(buf)) oob(); + errno = errno_bak; perror( buf ); }