summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorBrian S. Dean <bsd@FreeBSD.org>2002-05-14 22:08:07 +0000
committerBrian S. Dean <bsd@FreeBSD.org>2002-05-14 22:08:07 +0000
commitb56de993cede339c1aaadd24ecc775aea37e495d (patch)
treee6c1cb9c93cf398ab325bb1bbbb654138eb76589 /usr.bin
parent1f66ef9f8456a9a97d121d2f0f52f80ec2991386 (diff)
Notes
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tftp/main.c7
-rw-r--r--usr.bin/tftp/tftp.c4
2 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/tftp/main.c b/usr.bin/tftp/main.c
index 6511fdc8c8aa..71c0342fed70 100644
--- a/usr.bin/tftp/main.c
+++ b/usr.bin/tftp/main.c
@@ -85,6 +85,7 @@ int margc;
char *margv[20];
char *prompt = "tftp";
jmp_buf toplevel;
+volatile int txrx_error;
void intr();
void get __P((int, char **));
@@ -161,7 +162,7 @@ main(argc, argv)
signal(SIGINT, intr);
if (argc > 1) {
if (setjmp(toplevel) != 0)
- exit(0);
+ exit(txrx_error);
setpeer(argc, argv);
}
if (setjmp(toplevel) != 0)
@@ -616,7 +617,7 @@ command()
printf("%s> ", prompt);
if (fgets(line, sizeof line , stdin) == 0) {
if (feof(stdin)) {
- exit(0);
+ exit(txrx_error);
} else {
continue;
}
@@ -704,7 +705,7 @@ quit(argc, argv)
char *argv[];
{
- exit(0);
+ exit(txrx_error);
}
/*
diff --git a/usr.bin/tftp/tftp.c b/usr.bin/tftp/tftp.c
index 913f00acfd56..74aa7d4475d6 100644
--- a/usr.bin/tftp/tftp.c
+++ b/usr.bin/tftp/tftp.c
@@ -70,6 +70,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];
@@ -171,6 +172,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) {
@@ -287,6 +289,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);
}