0001-dma-prevent-races-from-sharing-fd-between-children.patch
| b/libexec/dma/dma.c | ||
|---|---|---|
| 484 | 484 |
{
|
| 485 | 485 |
struct sigaction sa; |
| 486 | 486 |
struct qitem *it; |
| 487 |
FILE *newqf; |
|
| 487 | 488 |
pid_t pid; |
| 488 | 489 | |
| 489 | 490 |
if (daemonize && daemon(0, 0) != 0) {
|
| ... | ... | |
| 515 | 516 |
* |
| 516 | 517 |
* return and deliver mail |
| 517 | 518 |
*/ |
| 519 |
/* |
|
| 520 |
* We have to prevent sharing of fds between children, so |
|
| 521 |
* we have to dup the queue fd. |
|
| 522 |
*/ |
|
| 523 |
newqf = fdopen(dup(fileno(it->queuef)), "r"); |
|
| 524 |
if (newqf == NULL) {
|
|
| 525 |
syslog(LOG_ERR, "can not dup queue fd: %m"); |
|
| 526 |
exit(1); |
|
| 527 |
} |
|
| 528 |
fclose(it->queuef); |
|
| 529 |
it->queuef = newqf; |
|
| 518 | 530 |
return (it); |
| 519 | 531 | |
| 520 | 532 |
default: |
| 521 |
- |
|