chiark
/
gitweb
/
~ian
/
userv.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f12fa48
)
fix (we hope) fd-handling hanging bug reported by Simon Tatham
author
ian
<ian>
Fri, 12 Nov 2004 00:53:21 +0000
(
00:53
+0000)
committer
ian
<ian>
Fri, 12 Nov 2004 00:53:21 +0000
(
00:53
+0000)
client.c
patch
|
blob
|
history
debian/changelog
patch
|
blob
|
history
diff --git
a/client.c
b/client.c
index ab3ae6f0fb1e33fd16c8b6bba4ae1285f257229e..c5fbcd5a356dffaa61d3178932035dad1070a1a4 100644
(file)
--- a/
client.c
+++ b/
client.c
@@
-132,7
+132,7
@@
static const char *loginname;
static char *cwdbuf;
static size_t cwdbufsize;
static char *ovbuf;
static char *cwdbuf;
static size_t cwdbufsize;
static char *ovbuf;
-static int ovused, systemerror;
+static int ovused, systemerror
, socketfd
;
static void blocksignals(int how) {
sigset_t set;
static void blocksignals(int how) {
sigset_t set;
@@
-1220,6
+1220,8
@@
static void connect_pipes(void) {
reading= fdsetup[fd].mods & fdm_read;
catdup(catnamebuf, fdsetup[fd].copyfd, reading ? 0 : 1);
catdup(catnamebuf, fdsetup[fd].pipefd, reading ? 1 : 0);
reading= fdsetup[fd].mods & fdm_read;
catdup(catnamebuf, fdsetup[fd].copyfd, reading ? 0 : 1);
catdup(catnamebuf, fdsetup[fd].pipefd, reading ? 1 : 0);
+ if (close(socketfd))
+ fsyscallerror("%s: close client socket for for cat",catnamebuf);
close_unwanted_pipes();
execl("/bin/cat",catnamebuf,(char*)0);
fprintf(stderr,"userv: %s: cannot exec `cat': %s\n",catnamebuf,strerror(errno));
close_unwanted_pipes();
execl("/bin/cat",catnamebuf,(char*)0);
fprintf(stderr,"userv: %s: cannot exec `cat': %s\n",catnamebuf,strerror(errno));
@@
-1326,7
+1328,7
@@
static void NONRETURNING process_exitstatus(int status) {
}
int main(int argc, char *const *argv) {
}
int main(int argc, char *const *argv) {
- int status
, socketfd
;
+ int status;
#ifdef NDEBUG
# error Do not disable assertions in this security-critical code !
#ifdef NDEBUG
# error Do not disable assertions in this security-critical code !
diff --git
a/debian/changelog
b/debian/changelog
index 3a62245c6098a48a090168a845d68526283a8e7d..8660c2f047bada6a7d2cbd63f1d83afbd344d205 100644
(file)
--- a/
debian/changelog
+++ b/
debian/changelog
@@
-1,5
+1,9
@@
userv (1.0.3.99-0.0.1) unstable; urgency=low
userv (1.0.3.99-0.0.1) unstable; urgency=low
+ Bugfixes:
+ * Close client socket fd in spawned cats (avoids some service-side hangs
+ when client terminates). Thanks to report from Simon Tatham.
+
Minor portability fixes:
* Missing #include <string.h> and <stdlib.h> } Thanks to report
* getgroups returns int, not gid_t (!). } from Peter Benie.
Minor portability fixes:
* Missing #include <string.h> and <stdlib.h> } Thanks to report
* getgroups returns int, not gid_t (!). } from Peter Benie.