diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-26 01:48:07 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-26 01:48:07 +0000 |
commit | 1b044a81bb5f33fdd0a87acf577ccaed28e62adf (patch) | |
tree | 65952b3288fe2d58a89b73b0258595b556b2d586 /chrome/browser/browser_main.cc | |
parent | 4d48c393ad0143371d75f9d281811cd3f201a620 (diff) | |
download | chromium_src-1b044a81bb5f33fdd0a87acf577ccaed28e62adf.zip chromium_src-1b044a81bb5f33fdd0a87acf577ccaed28e62adf.tar.gz chromium_src-1b044a81bb5f33fdd0a87acf577ccaed28e62adf.tar.bz2 |
Fix signal handlers so we don't fail a DCHECK.
BUG=none
TEST=ctrl+c in debug mode doesn't cause a DCHECK failure.
Review URL: http://codereview.chromium.org/442018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33168 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_main.cc')
-rw-r--r-- | chrome/browser/browser_main.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index aff0551..a452dab 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -178,10 +178,10 @@ void GracefulShutdownHandler(int signal, const int expected_signal) { NewRunnableFunction(BrowserList::CloseAllBrowsersAndExit)); // Reinstall the default handler. We had one shot at graceful shutdown. - struct sigaction term_action; - memset(&term_action, 0, sizeof(term_action)); - term_action.sa_handler = SIG_DFL; - CHECK(sigaction(expected_signal, &term_action, NULL) == 0); + struct sigaction action; + memset(&action, 0, sizeof(action)); + action.sa_handler = SIG_DFL; + CHECK(sigaction(expected_signal, &action, NULL) == 0); if (posted) { LOG(WARNING) << "Posted task to UI thread; resetting signal " @@ -303,16 +303,17 @@ int BrowserMain(const MainFunctionParams& parameters) { // We need to handle SIGTERM, because that is how many POSIX-based distros ask // processes to quit gracefully at shutdown time. - struct sigaction term_action; - memset(&term_action, 0, sizeof(term_action)); - term_action.sa_handler = SIGTERMHandler; - CHECK(sigaction(SIGTERM, &term_action, NULL) == 0); + memset(&action, 0, sizeof(action)); + action.sa_handler = SIGTERMHandler; + CHECK(sigaction(SIGTERM, &action, NULL) == 0); // Also handle SIGINT - when the user terminates the browser via Ctrl+C. // If the browser process is being debugged, GDB will catch the SIGINT first. - CHECK(sigaction(SIGINT, &term_action, NULL) == 0); + action.sa_handler = SIGINTHandler; + CHECK(sigaction(SIGINT, &action, NULL) == 0); // And SIGHUP, for when the terminal disappears. On shutdown, many Linux // distros send SIGHUP, SIGTERM, and then SIGKILL. - CHECK(sigaction(SIGHUP, &term_action, NULL) == 0); + action.sa_handler = SIGHUPHandler; + CHECK(sigaction(SIGHUP, &action, NULL) == 0); const std::wstring fd_limit_string = parsed_command_line.GetSwitchValue(switches::kFileDescriptorLimit); |