Cache PID refactor

This commit is contained in:
2021-05-03 21:04:52 +02:00
parent 28f163f97a
commit 10d405e745
2 changed files with 4 additions and 4 deletions

View File

@ -214,20 +214,18 @@ int cache_init() {
if (pid == 0) {
// child
if (cache_process() == 0) {
return 1;
return 0;
} else {
return -6;
}
} else if (pid > 0) {
// parent
fprintf(stderr, "Started child process with PID %i as cache-updater\n", pid);
children[0] = pid;
return pid;
} else {
fprintf(stderr, ERR_STR "Unable to create child process: %s" CLR_STR "\n", strerror(errno));
return -5;
}
return 0;
}
int cache_unload() {

View File

@ -323,6 +323,8 @@ int main(int argc, const char *argv[]) {
config_unload();
return 1;
} else if (ret != 0) {
children[0] = ret; // pid
} else {
return 0;
}