Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: chrome/app/chrome_dll_main.cc

Issue 467028: POSIX: sanitise signal handling state at startup. (Closed)
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // TODO(port): the ifdefs in here are a first step towards trying to determine 5 // TODO(port): the ifdefs in here are a first step towards trying to determine
6 // the correct abstraction for all the OS functionality required at this 6 // the correct abstraction for all the OS functionality required at this
7 // stage of process initialization. It should not be taken as a final 7 // stage of process initialization. It should not be taken as a final
8 // abstraction. 8 // abstraction.
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 #if defined(OS_LINUX) 333 #if defined(OS_LINUX)
334 g_fds->Set(kCrashDumpSignal, 334 g_fds->Set(kCrashDumpSignal,
335 kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor); 335 kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor);
336 #endif 336 #endif
337 #endif 337 #endif
338 338
339 #if defined(OS_POSIX) 339 #if defined(OS_POSIX)
340 // Set C library locale to make sure CommandLine can parse argument values 340 // Set C library locale to make sure CommandLine can parse argument values
341 // in correct encoding. 341 // in correct encoding.
342 setlocale(LC_ALL, ""); 342 setlocale(LC_ALL, "");
343
344 // Sanitise our signal handling state. Signals that were ignored by our
345 // parent will also be ignored by us. We also inherit our parent's sigmask.
346 sigset_t empty_signal_set;
347 CHECK(0 == sigemptyset(&empty_signal_set));
348 CHECK(0 == sigprocmask(SIG_SETMASK, &empty_signal_set, NULL));
349
350 struct sigaction sigact;
351 memset(&sigact, 0, sizeof(sigact));
352 sigact.sa_handler = SIG_DFL;
353 static const int signals_to_reset[] =
Markus (顧孟勤) 2009/12/05 00:17:40 Please add the missing signals, that I mentioned t
354 {SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, SIGFPE, SIGSEGV,
355 SIGALRM, SIGTERM, SIGCHLD}; // SIGPIPE is set below.
356 for (unsigned i = 0; i < arraysize(signals_to_reset); i++) {
357 CHECK(0 == sigaction(signals_to_reset[i], &sigact, NULL));
358 }
343 #endif 359 #endif
344 360
345 // Initialize the command line. 361 // Initialize the command line.
346 #if defined(OS_WIN) 362 #if defined(OS_WIN)
347 CommandLine::Init(0, NULL); 363 CommandLine::Init(0, NULL);
348 #else 364 #else
349 CommandLine::Init(argc, argv); 365 CommandLine::Init(argc, argv);
350 #endif 366 #endif
351 367
352 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); 368 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 686
671 logging::CleanupChromeLogging(); 687 logging::CleanupChromeLogging();
672 688
673 #if defined(OS_MACOSX) && defined(GOOGLE_CHROME_BUILD) 689 #if defined(OS_MACOSX) && defined(GOOGLE_CHROME_BUILD)
674 // TODO(mark): See the TODO(mark) above at InitCrashReporter. 690 // TODO(mark): See the TODO(mark) above at InitCrashReporter.
675 DestructCrashReporter(); 691 DestructCrashReporter();
676 #endif // OS_MACOSX && GOOGLE_CHROME_BUILD 692 #endif // OS_MACOSX && GOOGLE_CHROME_BUILD
677 693
678 return rv; 694 return rv;
679 } 695 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698