diff options
author | 2020-03-10 14:22:26 +0000 | |
---|---|---|
committer | 2020-03-10 14:22:26 +0000 | |
commit | bfe2257568b639495bec91f5d690ae12bcd8ba57 (patch) | |
tree | f6f1c4ebba87debcd7db9c8706d70248c31f01d0 | |
parent | Ooops. Need both files. (diff) | |
download | wireguard-openbsd-bfe2257568b639495bec91f5d690ae12bcd8ba57.tar.xz wireguard-openbsd-bfe2257568b639495bec91f5d690ae12bcd8ba57.zip |
Narrow the visibility of some functions and variables local to output.c
Also make the outputs table const.
Based on a suggestion from claudio@, ok deraadt@ claudio@
-rw-r--r-- | usr.sbin/rpki-client/extern.h | 5 | ||||
-rw-r--r-- | usr.sbin/rpki-client/output.c | 27 |
2 files changed, 16 insertions, 16 deletions
diff --git a/usr.sbin/rpki-client/extern.h b/usr.sbin/rpki-client/extern.h index 3348c4903aa..29b08e24135 100644 --- a/usr.sbin/rpki-client/extern.h +++ b/usr.sbin/rpki-client/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.25 2020/03/09 23:50:01 jca Exp $ */ +/* $OpenBSD: extern.h,v 1.26 2020/03/10 14:22:26 jca Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -370,9 +370,6 @@ extern int outformats; extern char* outputdir; int outputfiles(struct vrp_tree *v); -FILE *output_createtmp(char *); -void output_cleantmp(void); -int output_finish(FILE *); int output_bgpd(FILE *, struct vrp_tree *); int output_bird1v4(FILE *, struct vrp_tree *); int output_bird1v6(FILE *, struct vrp_tree *); diff --git a/usr.sbin/rpki-client/output.c b/usr.sbin/rpki-client/output.c index 431d8bfd1ca..99f127bb2a7 100644 --- a/usr.sbin/rpki-client/output.c +++ b/usr.sbin/rpki-client/output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output.c,v 1.8 2020/03/09 23:50:01 jca Exp $ */ +/* $OpenBSD: output.c,v 1.9 2020/03/10 14:22:26 jca Exp $ */ /* * Copyright (c) 2019 Theo de Raadt <deraadt@openbsd.org> * @@ -29,12 +29,12 @@ #include "extern.h" char *outputdir; -char output_tmpname[PATH_MAX]; -char output_name[PATH_MAX]; - int outformats; -struct outputs { +static char output_tmpname[PATH_MAX]; +static char output_name[PATH_MAX]; + +static const struct outputs { int format; char *name; int (*fn)(FILE *, struct vrp_tree *); @@ -48,8 +48,11 @@ struct outputs { { 0, NULL } }; -void sig_handler(int); -void set_signal_handler(void); +static FILE *output_createtmp(char *); +static void output_cleantmp(void); +static int output_finish(FILE *); +static void sig_handler(int); +static void set_signal_handler(void); int outputfiles(struct vrp_tree *v) @@ -89,7 +92,7 @@ outputfiles(struct vrp_tree *v) return rc; } -FILE * +static FILE * output_createtmp(char *name) { FILE *f; @@ -113,7 +116,7 @@ output_createtmp(char *name) return f; } -int +static int output_finish(FILE *out) { if (fclose(out) != 0) @@ -124,7 +127,7 @@ output_finish(FILE *out) return 0; } -void +static void output_cleantmp(void) { if (*output_tmpname) @@ -135,7 +138,7 @@ output_cleantmp(void) /* * Signal handler that clears the temporary files. */ -void +static void sig_handler(int sig __unused) { output_cleantmp(); @@ -145,7 +148,7 @@ sig_handler(int sig __unused) /* * Set signal handler on panic signals. */ -void +static void set_signal_handler(void) { struct sigaction sa; |