save errno in sys_error()
the print functions prior to perror() might otherwise clobber it.
This commit is contained in:
parent
6e56f39fa9
commit
e295f483d9
|
@ -27,6 +27,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
@ -154,9 +155,11 @@ vsys_error( const char *msg, va_list va )
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
|
int errno_bak = errno;
|
||||||
flushn();
|
flushn();
|
||||||
if ((uint)vsnprintf( buf, sizeof(buf), msg, va ) >= sizeof(buf))
|
if ((uint)vsnprintf( buf, sizeof(buf), msg, va ) >= sizeof(buf))
|
||||||
oob();
|
oob();
|
||||||
|
errno = errno_bak;
|
||||||
perror( buf );
|
perror( buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user