Bug #1416 » 0001-dma-prevent-races-from-sharing-fd-between-children.patch
| libexec/dma/dma.c | ||
|---|---|---|
|
{
|
||
|
struct sigaction sa;
|
||
|
struct qitem *it;
|
||
|
FILE *newqf;
|
||
|
pid_t pid;
|
||
|
if (daemonize && daemon(0, 0) != 0) {
|
||
| ... | ... | |
|
*
|
||
|
* return and deliver mail
|
||
|
*/
|
||
|
/*
|
||
|
* We have to prevent sharing of fds between children, so
|
||
|
* we have to dup the queue fd.
|
||
|
*/
|
||
|
newqf = fdopen(fileno(it->queuef), "r");
|
||
|
if (newqf == NULL) {
|
||
|
syslog(LOG_ERR, "can not dup queue fd: %m");
|
||
|
exit(1);
|
||
|
}
|
||
|
fclose(it->queuef);
|
||
|
it->queuef = newqf;
|
||
|
return (it);
|
||
|
default:
|
||