From 304cb0877c6b01fcc3e2e4a215dbc8b86b1f5e86 Mon Sep 17 00:00:00 2001 From: hpa Date: Sat, 21 Jul 2001 02:02:43 +0000 Subject: [PATCH] Quiet final set of warnings. --- tftp/extern.h | 5 +++++ tftp/main.c | 16 +++++----------- tftp/tftpsubs.c | 7 ++++--- tftp/tftpsubs.h | 14 ++++++++++++++ tftpd/tftpd.c | 13 ++++++++----- 5 files changed, 36 insertions(+), 19 deletions(-) diff --git a/tftp/extern.h b/tftp/extern.h index 0d8c5e8..4d4d016 100644 --- a/tftp/extern.h +++ b/tftp/extern.h @@ -38,5 +38,10 @@ * @(#)extern.h 8.1 (Berkeley) 6/6/93 */ +#ifndef RECVFILE_H +#define RECVFILE_H + void recvfile (int, char *, char *); void sendfile (int, char *, char *); + +#endif diff --git a/tftp/main.c b/tftp/main.c index f89ee1f..844b4b4 100644 --- a/tftp/main.c +++ b/tftp/main.c @@ -34,13 +34,16 @@ * SUCH DAMAGE. */ +#include "tftpsubs.h" + #ifndef lint -static const char *copyright = +static const char *copyright UNUSED = "@(#) Copyright (c) 1983, 1993\n\ The Regents of the University of California. All rights reserved.\n"; /* static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; */ /* static char rcsid[] = "$OpenBSD: main.c,v 1.4 1997/01/17 07:13:30 millert Exp $"; */ -static const char *rcsid = "tftp-hpa $Id$"; +static const char *rcsid UNUSED = + "tftp-hpa $Id$"; #endif /* not lint */ /* Many bug fixes are from Jim Guyton */ @@ -66,17 +69,8 @@ static const char *rcsid = "tftp-hpa $Id$"; #include #include -#include "../config.h" #include "extern.h" -void bsd_signal(int, void (*)(int)); - -#ifndef HAVE_SIGSETJMP -#define sigsetjmp(x,y) setjmp(x) -#define siglongjmp(x,y) longjmp(x,y) -#define sigjmp_buf jmp_buf -#endif - #define TIMEOUT 5 /* secs between rexmt's */ #define LBUFLEN 200 /* size of input buffer */ diff --git a/tftp/tftpsubs.c b/tftp/tftpsubs.c index 53ca7d5..8f66f4b 100644 --- a/tftp/tftpsubs.c +++ b/tftp/tftpsubs.c @@ -36,10 +36,13 @@ * SUCH DAMAGE. */ +#include "tftpsubs.h" + #ifndef lint /* static char sccsid[] = "@(#)tftpsubs.c 8.1 (Berkeley) 6/6/93"; */ /* static char rcsid[] = "$OpenBSD: tftpsubs.c,v 1.2 1996/06/26 05:40:36 deraadt Exp $"; */ -static const char *rcsid = "tftp-hpa: $Id$"; +static const char *rcsid UNUSED = +"tftp-hpa: $Id$"; #endif /* not lint */ /* Simple minded read-ahead/write-behind subroutines for tftp user and @@ -62,8 +65,6 @@ static const char *rcsid = "tftp-hpa: $Id$"; #include #include -#include "tftpsubs.h" - #define PKTSIZE MAX_SEGSIZE+4 /* should be moved to tftp.h */ int segsize = SEGSIZE; /* Default segsize */ diff --git a/tftp/tftpsubs.h b/tftp/tftpsubs.h index d2e0969..0937dad 100644 --- a/tftp/tftpsubs.h +++ b/tftp/tftpsubs.h @@ -47,6 +47,9 @@ #include #include +#include +#include +#include "../config.h" struct tftphdr; @@ -69,6 +72,17 @@ extern int segsize; extern void *xmalloc(size_t); extern char *xstrdup(const char *); +/* + * Signal-related stuff + */ +void bsd_signal(int, void (*)(int)); + +#ifndef HAVE_SIGSETJMP +#define sigsetjmp(x,y) setjmp(x) +#define siglongjmp(x,y) longjmp(x,y) +#define sigjmp_buf jmp_buf +#endif + /* * How to annotate unused variables */ diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c index 7edd955..d99b3f1 100644 --- a/tftpd/tftpd.c +++ b/tftpd/tftpd.c @@ -775,8 +775,9 @@ void sendfile(struct formats *pf, struct tftphdr *oap, int oacklen) { struct tftphdr *dp; - struct tftphdr *ap; /* ack packet */ - int block = 1, size, n; + struct tftphdr *ap; /* ack packet */ + static int block = 1; /* Static to avoid longjmp funnies */ + int size, n; ap = (struct tftphdr *)ackbuf; @@ -814,7 +815,7 @@ sendfile(struct formats *pf, struct tftphdr *oap, int oacklen) } } } - + dp = r_init(); do { size = readit(file, &dp, pf->f_convert); @@ -882,8 +883,10 @@ void recvfile(struct formats *pf, struct tftphdr *oap, int oacklen) { struct tftphdr *dp; - struct tftphdr *ap; /* ack buffer */ - int block = 0, acksize, n, size; + int n, size; + /* These are "static" to avoid longjmp funnies */ + static struct tftphdr *ap; /* ack buffer */ + static int block = 0, acksize; dp = w_init(); do {