Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/tftp Undo the non-sharing of the "toplevel" jmp_buf ...
details: https://anonhg.NetBSD.org/src/rev/fb9e24c74a0a
branches: trunk
changeset: 780219:fb9e24c74a0a
user: he <he%NetBSD.org@localhost>
date: Mon Jul 16 09:20:26 2012 +0000
description:
Undo the non-sharing of the "toplevel" jmp_buf between main.c and tftp.c,
so that we don't get a core dump if a transfer time-out is experienced.
Also, get rid of an extranous newline printed in the case of time-out.
diffstat:
usr.bin/tftp/main.c | 7 ++++---
usr.bin/tftp/tftp.c | 9 +++++----
2 files changed, 9 insertions(+), 7 deletions(-)
diffs (74 lines):
diff -r f9758c86aec2 -r fb9e24c74a0a usr.bin/tftp/main.c
--- a/usr.bin/tftp/main.c Mon Jul 16 06:33:05 2012 +0000
+++ b/usr.bin/tftp/main.c Mon Jul 16 09:20:26 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.31 2012/03/20 20:34:59 matt Exp $ */
+/* $NetBSD: main.c,v 1.32 2012/07/16 09:20:26 he Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -36,7 +36,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: main.c,v 1.31 2012/03/20 20:34:59 matt Exp $");
+__RCSID("$NetBSD: main.c,v 1.32 2012/07/16 09:20:26 he Exp $");
#endif
#endif /* not lint */
@@ -87,6 +87,8 @@
ushort mcmasterslave;
int maxtimeout = 5 * TIMEOUT;
+jmp_buf toplevel;
+
static int connected;
static char mode[32];
static char line[LBUFLEN];
@@ -94,7 +96,6 @@
static char *margv[20];
static const char *prompt = "tftp";
static char hostname[MAXHOSTNAMELEN];
-static jmp_buf toplevel;
static void get(int, char **);
static void help(int, char **);
diff -r f9758c86aec2 -r fb9e24c74a0a usr.bin/tftp/tftp.c
--- a/usr.bin/tftp/tftp.c Mon Jul 16 06:33:05 2012 +0000
+++ b/usr.bin/tftp/tftp.c Mon Jul 16 09:20:26 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tftp.c,v 1.33 2012/03/20 20:34:59 matt Exp $ */
+/* $NetBSD: tftp.c,v 1.34 2012/07/16 09:20:26 he Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)tftp.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: tftp.c,v 1.33 2012/03/20 20:34:59 matt Exp $");
+__RCSID("$NetBSD: tftp.c,v 1.34 2012/07/16 09:20:26 he Exp $");
#endif
#endif /* not lint */
@@ -67,9 +67,10 @@
#include "extern.h"
#include "tftpsubs.h"
+extern jmp_buf toplevel;
+
char ackbuf[PKTSIZE];
int timeout;
-jmp_buf toplevel;
jmp_buf timeoutbuf;
static void nak __P((int, struct sockaddr *));
@@ -749,7 +750,7 @@
timeout += rexmtval;
if (timeout >= maxtimeout) {
- (void)printf("Transfer timed out.\n");
+ (void)printf("Transfer timed out.");
longjmp(toplevel, -1);
}
longjmp(timeoutbuf, 1);
Home |
Main Index |
Thread Index |
Old Index