diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2016-03-13 18:34:22 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2016-03-13 18:34:22 +0000 |
commit | 8a59d71f31abaa642f02dbeac92ab61c3cfcb3e1 (patch) | |
tree | 0579de35b795570fbe1c5a9065453eb9f30f3a66 /lib | |
parent | e028b5ad03d3421ea9ae9ef0d16f68d503f04315 (diff) |
environ and __progname are not declared in a public header; declare them
in libc's hidden/stdlib.h instead of in each .c file that needs one
ok deraadt@ gsoares@ mpi@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/exec.c | 4 | ||||
-rw-r--r-- | lib/libc/gen/getprogname.c | 4 | ||||
-rw-r--r-- | lib/libc/gen/posix_spawn.c | 4 | ||||
-rw-r--r-- | lib/libc/gen/setproctitle.c | 4 | ||||
-rw-r--r-- | lib/libc/gen/setprogname.c | 4 | ||||
-rw-r--r-- | lib/libc/gen/syslog_r.c | 6 | ||||
-rw-r--r-- | lib/libc/gen/verr.c | 4 | ||||
-rw-r--r-- | lib/libc/gen/verrc.c | 4 | ||||
-rw-r--r-- | lib/libc/gen/verrx.c | 4 | ||||
-rw-r--r-- | lib/libc/gen/vwarn.c | 5 | ||||
-rw-r--r-- | lib/libc/gen/vwarnc.c | 5 | ||||
-rw-r--r-- | lib/libc/gen/vwarnx.c | 5 | ||||
-rw-r--r-- | lib/libc/gmon/gmon.c | 3 | ||||
-rw-r--r-- | lib/libc/hidden/stdlib.h | 5 | ||||
-rw-r--r-- | lib/libc/stdlib/getenv.c | 3 | ||||
-rw-r--r-- | lib/libc/stdlib/malloc.c | 4 | ||||
-rw-r--r-- | lib/libc/stdlib/setenv.c | 3 | ||||
-rw-r--r-- | lib/libc/stdlib/system.c | 4 | ||||
-rw-r--r-- | lib/libc/sys/stack_protector.c | 4 |
19 files changed, 27 insertions, 52 deletions
diff --git a/lib/libc/gen/exec.c b/lib/libc/gen/exec.c index 73297ae9a79..2996d95ed71 100644 --- a/lib/libc/gen/exec.c +++ b/lib/libc/gen/exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.c,v 1.22 2015/09/12 14:56:50 guenther Exp $ */ +/* $OpenBSD: exec.c,v 1.23 2016/03/13 18:34:20 guenther Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -40,8 +40,6 @@ #include <string.h> #include <unistd.h> -extern char **environ; - int execl(const char *name, const char *arg, ...) { diff --git a/lib/libc/gen/getprogname.c b/lib/libc/gen/getprogname.c index 17046abc927..a020830c1e7 100644 --- a/lib/libc/gen/getprogname.c +++ b/lib/libc/gen/getprogname.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getprogname.c,v 1.3 2013/11/12 06:09:48 deraadt Exp $ */ +/* $OpenBSD: getprogname.c,v 1.4 2016/03/13 18:34:20 guenther Exp $ */ /* * Copyright (c) 2013 Antoine Jacoutot <ajacoutot@openbsd.org> * @@ -17,8 +17,6 @@ #include <stdlib.h> -extern const char *__progname; - const char * getprogname(void) { diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c index 27e6d741069..a2d55b49167 100644 --- a/lib/libc/gen/posix_spawn.c +++ b/lib/libc/gen/posix_spawn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: posix_spawn.c,v 1.8 2015/10/23 04:39:24 guenther Exp $ */ +/* $OpenBSD: posix_spawn.c,v 1.9 2016/03/13 18:34:20 guenther Exp $ */ /*- * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> * All rights reserved. @@ -36,8 +36,6 @@ #include <string.h> #include <unistd.h> -extern char **environ; - struct __posix_spawnattr { short sa_flags; pid_t sa_pgroup; diff --git a/lib/libc/gen/setproctitle.c b/lib/libc/gen/setproctitle.c index cf179fd7898..22b1547253b 100644 --- a/lib/libc/gen/setproctitle.c +++ b/lib/libc/gen/setproctitle.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setproctitle.c,v 1.14 2015/10/01 02:32:07 guenther Exp $ */ +/* $OpenBSD: setproctitle.c,v 1.15 2016/03/13 18:34:20 guenther Exp $ */ /* * Copyright (c) 1994, 1995 Christopher G. Demetriou * All rights reserved. @@ -41,8 +41,6 @@ #define MAX_PROCTITLE 2048 -extern char *__progname; /* Program name, from crt0. */ - void setproctitle(const char *fmt, ...) { diff --git a/lib/libc/gen/setprogname.c b/lib/libc/gen/setprogname.c index 089a15ae29a..ec3189fa699 100644 --- a/lib/libc/gen/setprogname.c +++ b/lib/libc/gen/setprogname.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setprogname.c,v 1.4 2013/11/12 06:09:48 deraadt Exp $ */ +/* $OpenBSD: setprogname.c,v 1.5 2016/03/13 18:34:20 guenther Exp $ */ /* * Copyright (c) 2013 Antoine Jacoutot <ajacoutot@openbsd.org> * @@ -18,8 +18,6 @@ #include <string.h> #include <stdlib.h> -extern const char *__progname; - void setprogname(const char *progname) { diff --git a/lib/libc/gen/syslog_r.c b/lib/libc/gen/syslog_r.c index c12534019af..f89107d796f 100644 --- a/lib/libc/gen/syslog_r.c +++ b/lib/libc/gen/syslog_r.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syslog_r.c,v 1.12 2016/02/19 23:49:38 millert Exp $ */ +/* $OpenBSD: syslog_r.c,v 1.13 2016/03/13 18:34:20 guenther Exp $ */ /* * Copyright (c) 1983, 1988, 1993 * The Regents of the University of California. All rights reserved. @@ -36,6 +36,7 @@ #include <fcntl.h> #include <paths.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <syslog.h> #include <time.h> @@ -43,9 +44,6 @@ #include <limits.h> #include <stdarg.h> -extern char *__progname; /* Program name, from crt0. */ - - /* Reentrant version of syslog, i.e. syslog_r() */ void syslog_r(int pri, struct syslog_data *data, const char *fmt, ...) diff --git a/lib/libc/gen/verr.c b/lib/libc/gen/verr.c index 8f4722b9ee5..b27b9caef8a 100644 --- a/lib/libc/gen/verr.c +++ b/lib/libc/gen/verr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: verr.c,v 1.10 2015/08/31 02:53:57 guenther Exp $ */ +/* $OpenBSD: verr.c,v 1.11 2016/03/13 18:34:20 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -35,8 +35,6 @@ #include <string.h> #include <stdarg.h> -extern char *__progname; /* Program name, from crt0. */ - __dead void verr(int eval, const char *fmt, va_list ap) { diff --git a/lib/libc/gen/verrc.c b/lib/libc/gen/verrc.c index 27aac8b5b0c..9a741efd25f 100644 --- a/lib/libc/gen/verrc.c +++ b/lib/libc/gen/verrc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: verrc.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ +/* $OpenBSD: verrc.c,v 1.3 2016/03/13 18:34:20 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -34,8 +34,6 @@ #include <string.h> #include <stdarg.h> -extern char *__progname; /* Program name, from crt0. */ - __dead void verrc(int eval, int code, const char *fmt, va_list ap) { diff --git a/lib/libc/gen/verrx.c b/lib/libc/gen/verrx.c index f0186b607ee..0c9308f97aa 100644 --- a/lib/libc/gen/verrx.c +++ b/lib/libc/gen/verrx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: verrx.c,v 1.10 2015/08/31 02:53:57 guenther Exp $ */ +/* $OpenBSD: verrx.c,v 1.11 2016/03/13 18:34:20 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -33,8 +33,6 @@ #include <stdlib.h> #include <stdarg.h> -extern char *__progname; /* Program name, from crt0. */ - __dead void verrx(int eval, const char *fmt, va_list ap) { diff --git a/lib/libc/gen/vwarn.c b/lib/libc/gen/vwarn.c index 44d8be48ef5..457d619ce0f 100644 --- a/lib/libc/gen/vwarn.c +++ b/lib/libc/gen/vwarn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vwarn.c,v 1.10 2015/08/31 02:53:57 guenther Exp $ */ +/* $OpenBSD: vwarn.c,v 1.11 2016/03/13 18:34:20 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -31,11 +31,10 @@ #include <err.h> #include <errno.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <stdarg.h> -extern char *__progname; /* Program name, from crt0. */ - void vwarn(const char *fmt, va_list ap) { diff --git a/lib/libc/gen/vwarnc.c b/lib/libc/gen/vwarnc.c index eb95d15c24f..e528de37283 100644 --- a/lib/libc/gen/vwarnc.c +++ b/lib/libc/gen/vwarnc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vwarnc.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ +/* $OpenBSD: vwarnc.c,v 1.3 2016/03/13 18:34:20 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -30,11 +30,10 @@ #include <err.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <stdarg.h> -extern char *__progname; /* Program name, from crt0. */ - void vwarnc(int code, const char *fmt, va_list ap) { diff --git a/lib/libc/gen/vwarnx.c b/lib/libc/gen/vwarnx.c index 67d8f5b5706..146e267773d 100644 --- a/lib/libc/gen/vwarnx.c +++ b/lib/libc/gen/vwarnx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vwarnx.c,v 1.10 2015/08/31 02:53:57 guenther Exp $ */ +/* $OpenBSD: vwarnx.c,v 1.11 2016/03/13 18:34:20 guenther Exp $ */ /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -30,10 +30,9 @@ #include <err.h> #include <stdio.h> +#include <stdlib.h> #include <stdarg.h> -extern char *__progname; /* Program name, from crt0. */ - void vwarnx(const char *fmt, va_list ap) { diff --git a/lib/libc/gmon/gmon.c b/lib/libc/gmon/gmon.c index 38d5aa87c95..3ac54b3dc48 100644 --- a/lib/libc/gmon/gmon.c +++ b/lib/libc/gmon/gmon.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gmon.c,v 1.26 2016/01/19 20:32:29 mmcc Exp $ */ +/* $OpenBSD: gmon.c,v 1.27 2016/03/13 18:34:20 guenther Exp $ */ /*- * Copyright (c) 1983, 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -178,7 +178,6 @@ _mcleanup(void) moncontrol(0); if (issetugid() == 0 && (profdir = getenv("PROFDIR")) != NULL) { - extern char *__progname; char *s, *t, *limit; pid_t pid; long divisor; diff --git a/lib/libc/hidden/stdlib.h b/lib/libc/hidden/stdlib.h index 0370fb8f5fe..8898423c8d8 100644 --- a/lib/libc/hidden/stdlib.h +++ b/lib/libc/hidden/stdlib.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stdlib.h,v 1.6 2015/11/10 04:14:03 guenther Exp $ */ +/* $OpenBSD: stdlib.h,v 1.7 2016/03/13 18:34:21 guenther Exp $ */ /* $NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $ */ /*- @@ -42,6 +42,9 @@ char *__findenv(const char *, int, int *); void __atexit_register_cleanup(void (*)(void)); __END_HIDDEN_DECLS +extern char **environ; +extern char *__progname; + #if 0 extern PROTO_NORMAL(__mb_cur_max); /*extern PROTO_NORMAL(suboptarg);*/ diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c index 6ddad9225a3..054497b4320 100644 --- a/lib/libc/stdlib/getenv.c +++ b/lib/libc/stdlib/getenv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getenv.c,v 1.11 2015/09/13 08:31:47 guenther Exp $ */ +/* $OpenBSD: getenv.c,v 1.12 2016/03/13 18:34:21 guenther Exp $ */ /* * Copyright (c) 1987, 1993 * The Regents of the University of California. All rights reserved. @@ -45,7 +45,6 @@ char * __findenv(const char *name, int len, int *offset) { - extern char **environ; int i; const char *np; char **p, *cp; diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index d22fb38dae3..24b22854a5a 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.182 2016/02/25 00:38:51 deraadt Exp $ */ +/* $OpenBSD: malloc.c,v 1.183 2016/03/13 18:34:21 guenther Exp $ */ /* * Copyright (c) 2008, 2010, 2011 Otto Moerbeek <otto@drijf.net> * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> @@ -208,8 +208,6 @@ static int malloc_active; /* status of malloc */ static u_char getrbyte(struct dir_info *d); -extern char *__progname; - #ifdef MALLOC_STATS void malloc_dump(int); PROTO_NORMAL(malloc_dump); diff --git a/lib/libc/stdlib/setenv.c b/lib/libc/stdlib/setenv.c index e55a1feb6f9..1182abdaa34 100644 --- a/lib/libc/stdlib/setenv.c +++ b/lib/libc/stdlib/setenv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setenv.c,v 1.16 2015/09/13 08:31:47 guenther Exp $ */ +/* $OpenBSD: setenv.c,v 1.17 2016/03/13 18:34:21 guenther Exp $ */ /* * Copyright (c) 1987 Regents of the University of California. * All rights reserved. @@ -32,7 +32,6 @@ #include <stdlib.h> #include <string.h> -extern char **environ; static char **lastenv; /* last value of environ */ /* diff --git a/lib/libc/stdlib/system.c b/lib/libc/stdlib/system.c index de32d4328f7..fe718276b92 100644 --- a/lib/libc/stdlib/system.c +++ b/lib/libc/stdlib/system.c @@ -1,4 +1,4 @@ -/* $OpenBSD: system.c,v 1.11 2015/10/23 04:44:41 guenther Exp $ */ +/* $OpenBSD: system.c,v 1.12 2016/03/13 18:34:21 guenther Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. * All rights reserved. @@ -36,8 +36,6 @@ #include <unistd.h> #include <paths.h> -extern char **environ; - int system(const char *command) { diff --git a/lib/libc/sys/stack_protector.c b/lib/libc/sys/stack_protector.c index abaf7b56034..b1b07c2beda 100644 --- a/lib/libc/sys/stack_protector.c +++ b/lib/libc/sys/stack_protector.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stack_protector.c,v 1.21 2015/12/01 17:05:25 canacar Exp $ */ +/* $OpenBSD: stack_protector.c,v 1.22 2016/03/13 18:34:21 guenther Exp $ */ /* * Copyright (c) 2002 Hiroaki Etoh, Federico G. Schwindt, and Miodrag Vallat. @@ -28,6 +28,7 @@ */ #include <signal.h> +#include <stdlib.h> #include <string.h> #include <syslog.h> #include <unistd.h> @@ -49,7 +50,6 @@ long __guard_local __dso_hidden __attribute__((section(".openbsd.randomdata"))); void __stack_smash_handler(const char func[], int damaged) { - extern char *__progname; struct sigaction sa; sigset_t mask; char buf[1024]; |