aboutsummaryrefslogtreecommitdiff
path: root/tests/server/tftpd.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2013-01-09 15:10:23 +0100
committerYang Tse <yangsita@gmail.com>2013-01-09 22:23:50 +0100
commita6848250d279026252aa35cd9f93fafccc76333c (patch)
tree6cec3bacd94bd87c52b9e4bd3b73fe47704fbd3d /tests/server/tftpd.c
parenta9ca5e61e533def9e430597e36d70e96aee8e27a (diff)
test servers: fix errno, ERRNO and SOCKERRNO usage for W32/W64
Diffstat (limited to 'tests/server/tftpd.c')
-rw-r--r--tests/server/tftpd.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c
index e8c3c2d82..15c92778f 100644
--- a/tests/server/tftpd.c
+++ b/tests/server/tftpd.c
@@ -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;