Handle EINTR while dup2() in handlecgi(). - geomyidae - a small C-based gopherd… | |
git clone git://git.codemadness.org/geomyidae | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 6dc65c6ce9c4a41c034aa1f21d9ff2a1573efde4 | |
parent 73b1a17ecfe53540e39ca60059235ce91c70c932 | |
Author: Christoph Lohmann <[email protected]> | |
Date: Sat, 22 Jul 2023 17:17:35 +0200 | |
Handle EINTR while dup2() in handlecgi(). | |
Diffstat: | |
M handlr.c | 6 +++--- | |
1 file changed, 3 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/handlr.c b/handlr.c | |
@@ -167,9 +167,9 @@ handlecgi(int sock, char *file, char *port, char *base, cha… | |
if (args == NULL) | |
args = ""; | |
- dup2(sock, 0); | |
- dup2(sock, 1); | |
- dup2(sock, 2); | |
+ while (dup2(sock, 0) < 0 && errno == EINTR); | |
+ while (dup2(sock, 1) < 0 && errno == EINTR); | |
+ while (dup2(sock, 2) < 0 && errno == EINTR); | |
switch (fork()) { | |
case 0: | |
if (path != NULL) { |