test servers: fix errno, ERRNO and SOCKERRNO usage for W32/W64
This commit is contained in:
@@ -365,13 +365,13 @@ static void justtimeout(int signum)
|
||||
|
||||
static RETSIGTYPE exit_signal_handler(int signum)
|
||||
{
|
||||
int old_errno = ERRNO;
|
||||
int old_errno = errno;
|
||||
if(got_exit_signal == 0) {
|
||||
got_exit_signal = 1;
|
||||
exit_signal = signum;
|
||||
}
|
||||
(void)signal(signum, exit_signal_handler);
|
||||
SET_ERRNO(old_errno);
|
||||
errno = old_errno;
|
||||
}
|
||||
|
||||
static void install_signal_handlers(void)
|
||||
@@ -379,24 +379,24 @@ static void install_signal_handlers(void)
|
||||
#ifdef SIGHUP
|
||||
/* ignore SIGHUP signal */
|
||||
if((old_sighup_handler = signal(SIGHUP, SIG_IGN)) == SIG_ERR)
|
||||
logmsg("cannot install SIGHUP handler: %s", strerror(ERRNO));
|
||||
logmsg("cannot install SIGHUP handler: %s", strerror(errno));
|
||||
#endif
|
||||
#ifdef SIGPIPE
|
||||
/* ignore SIGPIPE signal */
|
||||
if((old_sigpipe_handler = signal(SIGPIPE, SIG_IGN)) == SIG_ERR)
|
||||
logmsg("cannot install SIGPIPE handler: %s", strerror(ERRNO));
|
||||
logmsg("cannot install SIGPIPE handler: %s", strerror(errno));
|
||||
#endif
|
||||
#ifdef SIGINT
|
||||
/* handle SIGINT signal with our exit_signal_handler */
|
||||
if((old_sigint_handler = signal(SIGINT, exit_signal_handler)) == SIG_ERR)
|
||||
logmsg("cannot install SIGINT handler: %s", strerror(ERRNO));
|
||||
logmsg("cannot install SIGINT handler: %s", strerror(errno));
|
||||
else
|
||||
siginterrupt(SIGINT, 1);
|
||||
#endif
|
||||
#ifdef SIGTERM
|
||||
/* handle SIGTERM signal with our exit_signal_handler */
|
||||
if((old_sigterm_handler = signal(SIGTERM, exit_signal_handler)) == SIG_ERR)
|
||||
logmsg("cannot install SIGTERM handler: %s", strerror(ERRNO));
|
||||
logmsg("cannot install SIGTERM handler: %s", strerror(errno));
|
||||
else
|
||||
siginterrupt(SIGTERM, 1);
|
||||
#endif
|
||||
@@ -953,7 +953,7 @@ static int do_tftp(struct testcase *test, struct tftphdr *tp, ssize_t size)
|
||||
/* Open request dump file. */
|
||||
server = fopen(REQUEST_DUMP, "ab");
|
||||
if(!server) {
|
||||
error = ERRNO;
|
||||
error = errno;
|
||||
logmsg("fopen() failed with error: %d %s", error, strerror(error));
|
||||
logmsg("Error opening file: %s", REQUEST_DUMP);
|
||||
return -1;
|
||||
@@ -1071,7 +1071,7 @@ static int validate_access(struct testcase *test,
|
||||
if(file) {
|
||||
FILE *stream=fopen(file, "rb");
|
||||
if(!stream) {
|
||||
error = ERRNO;
|
||||
error = errno;
|
||||
logmsg("fopen() failed with error: %d %s", error, strerror(error));
|
||||
logmsg("Error opening file: %s", file);
|
||||
logmsg("Couldn't open test file: %s", file);
|
||||
@@ -1123,7 +1123,7 @@ static void sendtftp(struct testcase *test, struct formats *pf)
|
||||
do {
|
||||
size = readit(test, &sdp, pf->f_convert);
|
||||
if (size < 0) {
|
||||
nak(ERRNO + 100);
|
||||
nak(errno + 100);
|
||||
return;
|
||||
}
|
||||
sdp->th_opcode = htons((unsigned short)opcode_DATA);
|
||||
@@ -1234,7 +1234,7 @@ send_ack:
|
||||
size = writeit(test, &rdp, (int)(n - 4), pf->f_convert);
|
||||
if (size != (n-4)) { /* ahem */
|
||||
if (size < 0)
|
||||
nak(ERRNO + 100);
|
||||
nak(errno + 100);
|
||||
else
|
||||
nak(ENOSPACE);
|
||||
goto abort;
|
||||
|
||||
Reference in New Issue
Block a user