diff options
| author | Pádraig Brady <P@draigBrady.com> | 2019-03-06 08:58:13 -0800 |
|---|---|---|
| committer | Pádraig Brady <P@draigBrady.com> | 2019-03-06 09:00:44 -0800 |
| commit | 4bbbe49074c996e90e19903dddd858ff8a2bf648 (patch) | |
| tree | aff24057406dc9d82bab785fe99e0cb1a1258e0d /src | |
| parent | efa3e5dda6ac1083f0f1267c2f8e2bf27bb8786f (diff) | |
| download | coreutils-4bbbe49074c996e90e19903dddd858ff8a2bf648.tar.gz coreutils-4bbbe49074c996e90e19903dddd858ff8a2bf648.zip | |
build: fix env build where SIGNUM_BOUND is not constant
* src/env.c (initialize_signals): A new function to initialize
the signals array on the heap, to avoid a build failure on
opensolaris, where SIGNUM_BOUND is not a constant.
Diffstat (limited to 'src')
| -rw-r--r-- | src/env.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -59,7 +59,7 @@ enum SIGNAL_MODE { IGNORE, /* Set to ignore (SIG_IGN). */ IGNORE_NOERR /* ditto, but ignore sigaction(2) errors. */ }; -static enum SIGNAL_MODE signals[SIGNUM_BOUND + 1]; +static enum SIGNAL_MODE *signals; /* Set of signals to block. */ static sigset_t block_signals; @@ -783,6 +783,17 @@ list_signal_handling (void) } } +static void +initialize_signals (void) +{ + signals = xmalloc ((sizeof *signals) * (SIGNUM_BOUND + 1)); + + for (int i = 0 ; i <= SIGNUM_BOUND; i++) + signals[i] = UNCHANGED; + + return; +} + int main (int argc, char **argv) { @@ -800,6 +811,8 @@ main (int argc, char **argv) initialize_exit_failure (EXIT_CANCELED); atexit (close_stdout); + initialize_signals (); + while ((optc = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1) { switch (optc) |
