mirror of https://github.com/openbsd/src.git
It isn't portable to use stderr (or std{in,out}) in file-scope
initializers as they are not required to be compile-time constants. So, intialize these global variables at the top of main(). ok miod@ deraadt@ yasuoka@ millert@
This commit is contained in:
parent
bc3c2f6195
commit
c0c9035167
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: pax.c,v 1.53 2019/06/28 13:34:59 deraadt Exp $ */
|
||||
/* $OpenBSD: pax.c,v 1.54 2023/07/05 18:45:14 guenther Exp $ */
|
||||
/* $NetBSD: pax.c,v 1.5 1996/03/26 23:54:20 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -93,7 +93,7 @@ char *dirptr; /* destination dir in a copy */
|
|||
char *argv0; /* root of argv[0] */
|
||||
enum op_mode op_mode; /* what program are we acting as? */
|
||||
sigset_t s_mask; /* signal mask for cleanup critical sect */
|
||||
FILE *listf = stderr; /* file pointer to print file list to */
|
||||
FILE *listf; /* file pointer to print file list to */
|
||||
int listfd = STDERR_FILENO; /* fd matching listf, for sighandler output */
|
||||
char *tempfile; /* tempfile to use for mkstemp(3) */
|
||||
char *tempbase; /* basename of tempfile to use for mkstemp(3) */
|
||||
|
@ -224,6 +224,8 @@ main(int argc, char **argv)
|
|||
char *tmpdir;
|
||||
size_t tdlen;
|
||||
|
||||
listf = stderr;
|
||||
|
||||
/*
|
||||
* Keep a reference to cwd, so we can always come back home.
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)amd.c 8.1 (Berkeley) 6/6/93
|
||||
* $Id: amd.c,v 1.24 2021/10/21 10:55:56 deraadt Exp $
|
||||
* $Id: amd.c,v 1.25 2023/07/05 18:45:14 guenther Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -190,6 +190,8 @@ main(int argc, char *argv[])
|
|||
pid_t ppid = 0;
|
||||
int error;
|
||||
|
||||
logfp = stderr; /* Log errors to stderr initially */
|
||||
|
||||
/*
|
||||
* Make sure some built-in assumptions are true before we start
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)xutil.c 8.1 (Berkeley) 6/6/93
|
||||
* $Id: xutil.c,v 1.19 2015/12/12 20:06:42 mmcc Exp $
|
||||
* $Id: xutil.c,v 1.20 2023/07/05 18:45:14 guenther Exp $
|
||||
*/
|
||||
|
||||
#include "am.h"
|
||||
|
@ -45,7 +45,7 @@
|
|||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
FILE *logfp = stderr; /* Log errors to stderr initially */
|
||||
FILE *logfp;
|
||||
int syslogging;
|
||||
int xlog_level = XLOG_ALL & ~XLOG_MAP & ~XLOG_STATS & ~XLOG_INFO;
|
||||
int xlog_level_init = ~0;
|
||||
|
|
Loading…
Reference in New Issue