Fix to MXS-35: https://mariadb.atlassian.net/browse/MXS-35
The parent process now correctly returns the value from the child process.
This commit is contained in:
@ -141,7 +141,7 @@ setipaddress(struct in_addr *a, char *p) {
|
||||
* Daemonize the process by forking and putting the process into the
|
||||
* background.
|
||||
*/
|
||||
void gw_daemonize(void) {
|
||||
bool gw_daemonize(void) {
|
||||
pid_t pid;
|
||||
|
||||
pid = fork();
|
||||
@ -153,13 +153,14 @@ void gw_daemonize(void) {
|
||||
|
||||
if (pid != 0) {
|
||||
/* exit from main */
|
||||
exit(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (setsid() < 0) {
|
||||
fprintf(stderr, "setsid() error %s\n", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user