We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a73e05c commit 6afc89eCopy full SHA for 6afc89e
tools/not.cpp
@@ -92,11 +92,14 @@ int main(int argc, char* const* argv) {
92
retcode = result;
93
signal = 0;
94
}
95
-#elif defined(WEXITSTATUS) && defined(WTERMSIG)
+#elif defined(WIFEXITED) && defined(WEXITSTATUS) && defined(WIFSIGNALED) && \
96
+ defined(WTERMSIG)
97
// On POSIX systems and Solaris, result is a composite value of the exit code
98
// and, potentially, the signal that caused termination of the command.
- retcode = WEXITSTATUS(result);
99
- signal = WTERMSIG(result);
+ if (WIFEXITED(result))
100
+ retcode = WEXITSTATUS(result);
101
+ if (WIFSIGNALED(result))
102
+ signal = WTERMSIG(result);
103
#else
104
#error "Unsupported system"
105
#endif
0 commit comments