summaryrefslogtreecommitdiffstats
path: root/usr.bin/tftp/tftp.c
diff options
context:
space:
mode:
authorbsd <bsd@FreeBSD.org>2002-05-12 01:47:50 +0000
committerbsd <bsd@FreeBSD.org>2002-05-12 01:47:50 +0000
commit7fd0cc174c07ea70fe9b483daadcc127d40fab92 (patch)
treee713f0ed3baada1e80ddc3aa03a7abdecc27f23a /usr.bin/tftp/tftp.c
parent9cc64ca23caaf7825c2002b6dbd81be05666b80f (diff)
downloadFreeBSD-src-7fd0cc174c07ea70fe9b483daadcc127d40fab92.zip
FreeBSD-src-7fd0cc174c07ea70fe9b483daadcc127d40fab92.tar.gz
To perform even basic error checking, one must have an exit code that
indicates that not everything worked as expected. Exit non-zero if we timed out while transmitting or receiving a file or if the file did not exist, etc. MFC After: 3 days (re@ willing)
Diffstat (limited to 'usr.bin/tftp/tftp.c')
-rw-r--r--usr.bin/tftp/tftp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/usr.bin/tftp/tftp.c b/usr.bin/tftp/tftp.c
index b2cc868..bac262f 100644
--- a/usr.bin/tftp/tftp.c
+++ b/usr.bin/tftp/tftp.c
@@ -72,6 +72,7 @@ extern int trace;
extern int verbose;
extern int rexmtval;
extern int maxtimeout;
+extern volatile int txrx_error;
#define PKTSIZE SEGSIZE+4
char ackbuf[PKTSIZE];
@@ -173,6 +174,7 @@ send_data:
if (ap->th_opcode == ERROR) {
printf("Error code %d: %s\n", ap->th_code,
ap->th_msg);
+ txrx_error = 1;
goto abort;
}
if (ap->th_opcode == ACK) {
@@ -289,6 +291,7 @@ send_ack:
if (dp->th_opcode == ERROR) {
printf("Error code %d: %s\n", dp->th_code,
dp->th_msg);
+ txrx_error = 1;
goto abort;
}
if (dp->th_opcode == DATA) {
@@ -479,6 +482,7 @@ timer(sig)
printf("Transfer timed out.\n");
longjmp(toplevel, -1);
}
+ txrx_error = 1;
longjmp(timeoutbuf, 1);
}
OpenPOWER on IntegriCloud