tftpd: mark symbols static

Mark symbols not accessed from other files static.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2008-07-30 16:17:02 -07:00
parent 7670c83e5a
commit 0c6f7f86d3

View file

@ -61,13 +61,13 @@
int deny_severity = LOG_WARNING; int deny_severity = LOG_WARNING;
int allow_severity = -1; /* Don't log at all */ int allow_severity = -1; /* Don't log at all */
struct request_info wrap_request; static struct request_info wrap_request;
#endif #endif
#ifdef HAVE_IPV6 #ifdef HAVE_IPV6
int ai_fam = AF_UNSPEC; static int ai_fam = AF_UNSPEC;
#else #else
int ai_fam = AF_INET; static int ai_fam = AF_INET;
#endif #endif
#define TIMEOUT 1000000 /* Default timeout (us) */ #define TIMEOUT 1000000 /* Default timeout (us) */
@ -75,29 +75,29 @@ int ai_fam = AF_INET;
#define TIMEOUT_LIMIT ((1 << TRIES)-1) #define TIMEOUT_LIMIT ((1 << TRIES)-1)
const char *__progname; const char *__progname;
int peer; static int peer;
unsigned long timeout = TIMEOUT; /* Current timeout value */ static unsigned long timeout = TIMEOUT; /* Current timeout value */
unsigned long rexmtval = TIMEOUT; /* Basic timeout value */ static unsigned long rexmtval = TIMEOUT; /* Basic timeout value */
unsigned long maxtimeout = TIMEOUT_LIMIT * TIMEOUT; static unsigned long maxtimeout = TIMEOUT_LIMIT * TIMEOUT;
int timeout_quit = 0; static int timeout_quit = 0;
sigjmp_buf timeoutbuf; static sigjmp_buf timeoutbuf;
#define PKTSIZE MAX_SEGSIZE+4 #define PKTSIZE MAX_SEGSIZE+4
char buf[PKTSIZE]; static char buf[PKTSIZE];
char ackbuf[PKTSIZE]; static char ackbuf[PKTSIZE];
unsigned int max_blksize = MAX_SEGSIZE; static unsigned int max_blksize = MAX_SEGSIZE;
char tmpbuf[INET6_ADDRSTRLEN], *tmp_p; static char tmpbuf[INET6_ADDRSTRLEN], *tmp_p;
union sock_addr from; static union sock_addr from;
socklen_t fromlen; static socklen_t fromlen;
off_t tsize; static off_t tsize;
int tsize_ok; static int tsize_ok;
int ndirs; static int ndirs;
const char **dirs; static const char **dirs;
int secure = 0; static int secure = 0;
int cancreate = 0; int cancreate = 0;
int unixperms = 0; int unixperms = 0;
int portrange = 0; int portrange = 0;
@ -111,15 +111,14 @@ static struct rule *rewrite_rules = NULL;
int tftp(struct tftphdr *, int); int tftp(struct tftphdr *, int);
static void nak(int, const char *); static void nak(int, const char *);
void timer(int); static void timer(int);
void justquit(int); static void do_opt(char *, char *, char **);
void do_opt(char *, char *, char **);
int set_blksize(char *, char **); static int set_blksize(char *, char **);
int set_blksize2(char *, char **); static int set_blksize2(char *, char **);
int set_tsize(char *, char **); static int set_tsize(char *, char **);
int set_timeout(char *, char **); static int set_timeout(char *, char **);
int set_utimeout(char *, char **); static int set_utimeout(char *, char **);
struct options { struct options {
const char *o_opt; const char *o_opt;
@ -889,10 +888,10 @@ int main(int argc, char **argv)
exit(0); exit(0);
} }
char *rewrite_access(char *, int, const char **); static char *rewrite_access(char *, int, const char **);
int validate_access(char *, int, struct formats *, const char **); static int validate_access(char *, int, struct formats *, const char **);
void tftp_sendfile(struct formats *, struct tftphdr *, int); static void tftp_sendfile(struct formats *, struct tftphdr *, int);
void tftp_recvfile(struct formats *, struct tftphdr *, int); static void tftp_recvfile(struct formats *, struct tftphdr *, int);
struct formats { struct formats {
const char *f_mode; const char *f_mode;
@ -1021,7 +1020,7 @@ static int blksize_set;
/* /*
* Set a non-standard block size (c.f. RFC2348) * Set a non-standard block size (c.f. RFC2348)
*/ */
int set_blksize(char *val, char **ret) static int set_blksize(char *val, char **ret)
{ {
static char b_ret[6]; static char b_ret[6];
unsigned int sz; unsigned int sz;
@ -1048,7 +1047,7 @@ int set_blksize(char *val, char **ret)
/* /*
* Set a power-of-two block size (nonstandard) * Set a power-of-two block size (nonstandard)
*/ */
int set_blksize2(char *val, char **ret) static int set_blksize2(char *val, char **ret)
{ {
static char b_ret[6]; static char b_ret[6];
unsigned int sz; unsigned int sz;
@ -1086,7 +1085,7 @@ int set_blksize2(char *val, char **ret)
* For netascii mode, we don't know the size ahead of time; * For netascii mode, we don't know the size ahead of time;
* so reject the option. * so reject the option.
*/ */
int set_tsize(char *val, char **ret) static int set_tsize(char *val, char **ret)
{ {
static char b_ret[sizeof(uintmax_t) * CHAR_BIT / 3 + 2]; static char b_ret[sizeof(uintmax_t) * CHAR_BIT / 3 + 2];
uintmax_t sz; uintmax_t sz;
@ -1109,7 +1108,7 @@ int set_tsize(char *val, char **ret)
* to be the (default) retransmission timeout, but being an * to be the (default) retransmission timeout, but being an
* integer in seconds it seems a bit limited. * integer in seconds it seems a bit limited.
*/ */
int set_timeout(char *val, char **ret) static int set_timeout(char *val, char **ret)
{ {
static char b_ret[4]; static char b_ret[4];
unsigned long to; unsigned long to;
@ -1128,7 +1127,7 @@ int set_timeout(char *val, char **ret)
} }
/* Similar, but in microseconds. We allow down to 10 ms. */ /* Similar, but in microseconds. We allow down to 10 ms. */
int set_utimeout(char *val, char **ret) static int set_utimeout(char *val, char **ret)
{ {
static char b_ret[4]; static char b_ret[4];
unsigned long to; unsigned long to;
@ -1149,7 +1148,7 @@ int set_utimeout(char *val, char **ret)
/* /*
* Parse RFC2347 style options * Parse RFC2347 style options
*/ */
void do_opt(char *opt, char *val, char **ap) static void do_opt(char *opt, char *val, char **ap)
{ {
struct options *po; struct options *po;
char *ret; char *ret;
@ -1188,9 +1187,7 @@ void do_opt(char *opt, char *val, char **ap)
* *
* Return -1 on failure. * Return -1 on failure.
*/ */
int rewrite_macros(char macro, char *output); static int rewrite_macros(char macro, char *output)
int rewrite_macros(char macro, char *output)
{ {
char *p, tb[INET6_ADDRSTRLEN]; char *p, tb[INET6_ADDRSTRLEN];
int l=0; int l=0;
@ -1236,7 +1233,7 @@ int rewrite_macros(char macro, char *output)
/* /*
* Modify the filename, if applicable. If it returns NULL, deny the access. * Modify the filename, if applicable. If it returns NULL, deny the access.
*/ */
char *rewrite_access(char *filename, int mode, const char **msg) static char *rewrite_access(char *filename, int mode, const char **msg)
{ {
if (rewrite_rules) { if (rewrite_rules) {
char *newname = char *newname =
@ -1248,7 +1245,7 @@ char *rewrite_access(char *filename, int mode, const char **msg)
} }
#else #else
char *rewrite_access(char *filename, int mode, const char **msg) static char *rewrite_access(char *filename, int mode, const char **msg)
{ {
(void)mode; /* Avoid warning */ (void)mode; /* Avoid warning */
(void)msg; (void)msg;
@ -1256,7 +1253,7 @@ char *rewrite_access(char *filename, int mode, const char **msg)
} }
#endif #endif
FILE *file; static FILE *file;
/* /*
* Validate file access. Since we * Validate file access. Since we
* have no uid or gid, for now require * have no uid or gid, for now require
@ -1268,8 +1265,7 @@ FILE *file;
* Note also, full path name must be * Note also, full path name must be
* given as we have no login directory. * given as we have no login directory.
*/ */
int static int validate_access(char *filename, int mode,
validate_access(char *filename, int mode,
struct formats *pf, const char **errmsg) struct formats *pf, const char **errmsg)
{ {
struct stat stbuf; struct stat stbuf;
@ -1378,7 +1374,7 @@ validate_access(char *filename, int mode,
/* /*
* Send the requested file. * Send the requested file.
*/ */
void tftp_sendfile(struct formats *pf, struct tftphdr *oap, int oacklen) static void tftp_sendfile(struct formats *pf, struct tftphdr *oap, int oacklen)
{ {
struct tftphdr *dp; struct tftphdr *dp;
struct tftphdr *ap; /* ack packet */ struct tftphdr *ap; /* ack packet */
@ -1472,17 +1468,10 @@ void tftp_sendfile(struct formats *pf, struct tftphdr *oap, int oacklen)
(void)fclose(file); (void)fclose(file);
} }
/* Bail out signal handler */
void justquit(int sig)
{
(void)sig; /* Suppress unused warning */
exit(0);
}
/* /*
* Receive a file. * Receive a file.
*/ */
void tftp_recvfile(struct formats *pf, struct tftphdr *oap, int oacklen) static void tftp_recvfile(struct formats *pf, struct tftphdr *oap, int oacklen)
{ {
struct tftphdr *dp; struct tftphdr *dp;
int n, size; int n, size;