diff options
| author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2016-05-27 00:05:27 +0200 |
|---|---|---|
| committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2016-05-29 18:36:52 +0000 |
| commit | d167afbe0ec394b28618a8af44eada7c7849c7c5 (patch) | |
| tree | 6420368e975b01fee8079e269163a729cd9e4ffd /doc/src/snippets/code/doc_src_unix-signal-handlers.cpp | |
| parent | f2e8c350ddf42df035ad9ff22e05b627c072f272 (diff) | |
Unix signals: fix check of sigaction's return value
sigaction(2) returns 0 on success, non-zero (-1) on failure,
so checking for > 0 is actually never going to detect failure.
Change-Id: I78b4a00be99de4c6424f0cfa0c91ff712e96d1ff
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'doc/src/snippets/code/doc_src_unix-signal-handlers.cpp')
| -rw-r--r-- | doc/src/snippets/code/doc_src_unix-signal-handlers.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/src/snippets/code/doc_src_unix-signal-handlers.cpp b/doc/src/snippets/code/doc_src_unix-signal-handlers.cpp index 4af0116c8..4007518d1 100644 --- a/doc/src/snippets/code/doc_src_unix-signal-handlers.cpp +++ b/doc/src/snippets/code/doc_src_unix-signal-handlers.cpp @@ -95,14 +95,14 @@ static int setup_unix_signal_handlers() hup.sa_flags = 0; hup.sa_flags |= SA_RESTART; - if (sigaction(SIGHUP, &hup, 0) > 0) + if (sigaction(SIGHUP, &hup, 0)) return 1; term.sa_handler = MyDaemon::termSignalHandler; sigemptyset(&term.sa_mask); term.sa_flags |= SA_RESTART; - if (sigaction(SIGTERM, &term, 0) > 0) + if (sigaction(SIGTERM, &term, 0)) return 2; return 0; |
