mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 19:27:35 +00:00
SystemServer: Remove always-true "if (pid == 0)" check
This code should probably be structured differently to handle things like children dying, etc. But not right now. Found by PVS-Studio.
This commit is contained in:
parent
673a98258b
commit
1c50dce7d2
1 changed files with 14 additions and 18 deletions
|
@ -1,11 +1,11 @@
|
||||||
#include <AK/Assertions.h>
|
#include <AK/Assertions.h>
|
||||||
|
#include <LibCore/CFile.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <LibCore/CFile.h>
|
|
||||||
|
|
||||||
void start_process(const char* prog, int prio)
|
void start_process(const char* prog, int prio)
|
||||||
{
|
{
|
||||||
|
@ -26,25 +26,21 @@ void start_process(const char* prog, int prio)
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (pid == 0) {
|
dbgprintf("Executing for %s... at prio %d\n", prog, prio);
|
||||||
dbgprintf("Executing for %s... at prio %d\n", prog, prio);
|
struct sched_param p;
|
||||||
struct sched_param p;
|
p.sched_priority = prio;
|
||||||
p.sched_priority = prio;
|
int ret = sched_setparam(pid, &p);
|
||||||
int ret = sched_setparam(pid, &p);
|
ASSERT(ret == 0);
|
||||||
ASSERT(ret == 0);
|
|
||||||
|
|
||||||
char* progv[256];
|
char* progv[256];
|
||||||
progv[0] = const_cast<char*>(prog);
|
progv[0] = const_cast<char*>(prog);
|
||||||
progv[1] = nullptr;
|
progv[1] = nullptr;
|
||||||
ret = execv(prog, progv);
|
ret = execv(prog, progv);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dbgprintf("Exec %s failed! %s", prog, strerror(errno));
|
dbgprintf("Exec %s failed! %s", prog, strerror(errno));
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue