Calling exit() from the cloned process is a bad idea, because we share
file descriptors with the parent, and exit() has side-effects (anyway,
more than the low-level _exit()).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
ret = setegid(data->gid);
if (ret < 0) {
perror("setegid");
- exit(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
}
if (data->uid != geteuid()) {
ret = seteuid(data->uid);
if (ret < 0) {
perror("seteuid");
- exit(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
}
/*
writeleft);
if (writelen < 0) {
perror("write");
- exit(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
writeleft -= writelen;
index += writelen;
} while (writeleft > 0);
-
- exit(EXIT_SUCCESS);
+ return EXIT_SUCCESS;
}
static