mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:38:11 +00:00
SystemMonitor: Correctly check error of posix_spawn()
posix_spawn() has a bit of a whacky API in that it doens't return 0 on success and -1 on failure while writing the error code to errno -- it instead returns 0 on success and the error code on error. So assign the return value to errno so that perror() does the right thing.
This commit is contained in:
parent
f5d920eb2e
commit
526ca68786
1 changed files with 1 additions and 1 deletions
|
@ -214,7 +214,7 @@ int main(int argc, char** argv)
|
|||
auto pid_string = String::format("%d", pid);
|
||||
pid_t child;
|
||||
const char* argv[] = { "/bin/Profiler", "--pid", pid_string.characters(), nullptr };
|
||||
if (posix_spawn(&child, "/bin/Profiler", nullptr, nullptr, const_cast<char**>(argv), environ) < 0) {
|
||||
if ((errno = posix_spawn(&child, "/bin/Profiler", nullptr, nullptr, const_cast<char**>(argv), environ))) {
|
||||
perror("posix_spawn");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue