diff options
Diffstat (limited to 'gdbsupport/signals-state-save-restore.cc')
-rw-r--r-- | gdbsupport/signals-state-save-restore.cc | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/gdbsupport/signals-state-save-restore.cc b/gdbsupport/signals-state-save-restore.cc index 3ec7a25..7b865bd 100644 --- a/gdbsupport/signals-state-save-restore.cc +++ b/gdbsupport/signals-state-save-restore.cc @@ -38,7 +38,7 @@ save_original_signals_state (bool quiet) int i; int res; - res = gdb_sigmask (0, NULL, &original_signal_mask); + res = gdb_sigmask (0, NULL, &original_signal_mask); if (res == -1) perror_with_name (("sigprocmask")); @@ -50,36 +50,35 @@ save_original_signals_state (bool quiet) res = sigaction (i, NULL, oldact); if (res == -1 && errno == EINVAL) - { - /* Some signal numbers in the range are invalid. */ - continue; - } + { + /* Some signal numbers in the range are invalid. */ + continue; + } else if (res == -1) - perror_with_name (("sigaction")); + perror_with_name (("sigaction")); /* If we find a custom signal handler already installed, then this function was called too late. This is a warning instead of an internal error because this can also happen if you LD_PRELOAD a library that installs a signal handler early via __attribute__((constructor)), like libSegFault.so. */ - if (!quiet - && oldact->sa_handler != SIG_DFL - && oldact->sa_handler != SIG_IGN) - { - found_preinstalled = true; + if (!quiet && oldact->sa_handler != SIG_DFL + && oldact->sa_handler != SIG_IGN) + { + found_preinstalled = true; - /* Use raw fprintf here because we're being called in early + /* Use raw fprintf here because we're being called in early startup, before GDB's filtered streams are created. */ - fprintf (stderr, - _("warning: Found custom handler for signal " - "%d (%s) preinstalled.\n"), i, - strsignal (i)); - } + fprintf (stderr, + _ ("warning: Found custom handler for signal " + "%d (%s) preinstalled.\n"), + i, strsignal (i)); + } } if (found_preinstalled) { - fprintf (stderr, _("\ + fprintf (stderr, _ ("\ Some signal dispositions inherited from the environment (SIG_DFL/SIG_IGN)\n\ won't be propagated to spawned programs.\n")); } @@ -99,15 +98,15 @@ restore_original_signals_state (void) { res = sigaction (i, &original_signal_actions[i], NULL); if (res == -1 && errno == EINVAL) - { - /* Some signal numbers in the range are invalid. */ - continue; - } + { + /* Some signal numbers in the range are invalid. */ + continue; + } else if (res == -1) - perror_with_name (("sigaction")); + perror_with_name (("sigaction")); } - res = gdb_sigmask (SIG_SETMASK, &original_signal_mask, NULL); + res = gdb_sigmask (SIG_SETMASK, &original_signal_mask, NULL); if (res == -1) perror_with_name (("sigprocmask")); #endif |