mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Correctly handle failure of pipe() call in swap_to_tcp()
This commit is contained in:
@@ -2091,11 +2091,11 @@ int swap_to_tcp(struct frec *forward, time_t now, int status, struct dns_header
|
|||||||
if (daemon->tcp_pids[i] == 0 && daemon->tcp_pipes[i] == -1)
|
if (daemon->tcp_pids[i] == 0 && daemon->tcp_pipes[i] == -1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* No slots */
|
/* No slots or no pipe */
|
||||||
if (i < 0)
|
if (i < 0 || pipe(pipefd) != 0)
|
||||||
return STAT_ABANDONED;
|
return STAT_ABANDONED;`
|
||||||
|
|
||||||
if (pipe(pipefd) == 0 && (p = fork()) != 0)
|
if ((p = fork()) != 0)
|
||||||
{
|
{
|
||||||
close(pipefd[1]); /* parent needs read pipe end. */
|
close(pipefd[1]); /* parent needs read pipe end. */
|
||||||
if (p == -1)
|
if (p == -1)
|
||||||
|
|||||||
@@ -767,8 +767,8 @@ int retry_send(ssize_t rc)
|
|||||||
|
|
||||||
/* rw = 0 -> write
|
/* rw = 0 -> write
|
||||||
rw = 1 -> read
|
rw = 1 -> read
|
||||||
rw = 2 -> read once
|
rw = 2 -> write once
|
||||||
rw = 3 -> write once
|
rw = 3 -> read once
|
||||||
|
|
||||||
"once" fail if all the data doesn't arrive/go in a single read/write.
|
"once" fail if all the data doesn't arrive/go in a single read/write.
|
||||||
This indicates a timeout of a TCP socket.
|
This indicates a timeout of a TCP socket.
|
||||||
|
|||||||
Reference in New Issue
Block a user