Cache PID refactor
This commit is contained in:
@ -214,20 +214,18 @@ int cache_init() {
|
|||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
// child
|
// child
|
||||||
if (cache_process() == 0) {
|
if (cache_process() == 0) {
|
||||||
return 1;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return -6;
|
return -6;
|
||||||
}
|
}
|
||||||
} else if (pid > 0) {
|
} else if (pid > 0) {
|
||||||
// parent
|
// parent
|
||||||
fprintf(stderr, "Started child process with PID %i as cache-updater\n", pid);
|
fprintf(stderr, "Started child process with PID %i as cache-updater\n", pid);
|
||||||
children[0] = pid;
|
return pid;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, ERR_STR "Unable to create child process: %s" CLR_STR "\n", strerror(errno));
|
fprintf(stderr, ERR_STR "Unable to create child process: %s" CLR_STR "\n", strerror(errno));
|
||||||
return -5;
|
return -5;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int cache_unload() {
|
int cache_unload() {
|
||||||
|
@ -323,6 +323,8 @@ int main(int argc, const char *argv[]) {
|
|||||||
config_unload();
|
config_unload();
|
||||||
return 1;
|
return 1;
|
||||||
} else if (ret != 0) {
|
} else if (ret != 0) {
|
||||||
|
children[0] = ret; // pid
|
||||||
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user