Module Name: src Committed By: he Date: Mon Jul 16 09:20:26 UTC 2012
Modified Files: src/usr.bin/tftp: main.c tftp.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/usr.bin/tftp/main.c cvs rdiff -u -r1.33 -r1.34 src/usr.bin/tftp/tftp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/tftp/main.c diff -u src/usr.bin/tftp/main.c:1.31 src/usr.bin/tftp/main.c:1.32 --- src/usr.bin/tftp/main.c:1.31 Tue Mar 20 20:34:59 2012 +++ src/usr.bin/tftp/main.c Mon Jul 16 09:20:26 2012 @@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19 #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 @@ u_int rexmtval = TIMEOUT; 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 int margc; 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 **); Index: src/usr.bin/tftp/tftp.c diff -u src/usr.bin/tftp/tftp.c:1.33 src/usr.bin/tftp/tftp.c:1.34 --- src/usr.bin/tftp/tftp.c:1.33 Tue Mar 20 20:34:59 2012 +++ src/usr.bin/tftp/tftp.c Mon Jul 16 09:20:26 2012 @@ -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 @@ __RCSID("$NetBSD: tftp.c,v 1.33 2012/03/ #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 @@ timer(int sig) timeout += rexmtval; if (timeout >= maxtimeout) { - (void)printf("Transfer timed out.\n"); + (void)printf("Transfer timed out."); longjmp(toplevel, -1); } longjmp(timeoutbuf, 1);