mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 07:28:39 +01:00
cgi-io: close pipe descriptors early
In the command read side, close the superfluous write end of the pipe
early to ensure that EOF is reliably detected. Without that change, splice
calls to read from the pipe will occasionally hang until the CGI process
is eventually killed due to timeout.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit dde503da13)
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=cgi-io
|
PKG_NAME:=cgi-io
|
||||||
PKG_RELEASE:=15
|
PKG_RELEASE:=16
|
||||||
|
|
||||||
PKG_LICENSE:=GPL-2.0-or-later
|
PKG_LICENSE:=GPL-2.0-or-later
|
||||||
|
|
||||||
|
|||||||
@@ -778,6 +778,8 @@ main_backup(int argc, char **argv)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
close(fds[1]);
|
||||||
|
|
||||||
now = time(NULL);
|
now = time(NULL);
|
||||||
strftime(datestr, sizeof(datestr) - 1, "%Y-%m-%d", localtime(&now));
|
strftime(datestr, sizeof(datestr) - 1, "%Y-%m-%d", localtime(&now));
|
||||||
|
|
||||||
@@ -798,7 +800,6 @@ main_backup(int argc, char **argv)
|
|||||||
waitpid(pid, &status, 0);
|
waitpid(pid, &status, 0);
|
||||||
|
|
||||||
close(fds[0]);
|
close(fds[0]);
|
||||||
close(fds[1]);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1010,6 +1011,8 @@ main_exec(int argc, char **argv)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
close(fds[1]);
|
||||||
|
|
||||||
printf("Status: 200 OK\r\n");
|
printf("Status: 200 OK\r\n");
|
||||||
printf("Content-Type: %s\r\n",
|
printf("Content-Type: %s\r\n",
|
||||||
fields[7] ? fields[7] : "application/octet-stream");
|
fields[7] ? fields[7] : "application/octet-stream");
|
||||||
@@ -1028,7 +1031,6 @@ main_exec(int argc, char **argv)
|
|||||||
waitpid(pid, &status, 0);
|
waitpid(pid, &status, 0);
|
||||||
|
|
||||||
close(fds[0]);
|
close(fds[0]);
|
||||||
close(fds[1]);
|
|
||||||
free(args);
|
free(args);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user