chiark / gitweb /
really detect WCOREDUMP properly
[userv.git] / client.c
index ab3ae6f0fb1e33fd16c8b6bba4ae1285f257229e..6664fbc4a8080b27d29b3cd1b3931584c4105da4 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 int ovused, systemerror;
+static int ovused, systemerror, socketfd;
 
 static void blocksignals(int how) {
   sigset_t set;
@@ -432,7 +432,8 @@ static void usage(FILE *stream) {
     "(separate with commas)  append  sync   excl[usive]  creat[e]  fd\n"
     "userv -B 'X' ... is same as userv --override 'execute-builtin X' - 'X' ...\n"
     "         for help, type `userv -B help'; remember to quote multi-word X\n"
-    "userv and uservd version " VERSION VEREXT "; copyright (C)1996-1999 Ian Jackson.\n"
+    "userv and uservd version " VERSION VEREXT ".\n"
+    "Copyright (C)1996-2003,2006 Ian Jackson; copyright (C)2000 Ben Harris.\n"
     "there is NO WARRANTY; type `userv --copyright' for details.\n",
             stream) < 0)
     syscallerror("write usage message");
@@ -1220,6 +1221,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);
+      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));
@@ -1326,7 +1329,7 @@ static void NONRETURNING process_exitstatus(int status) {
 }
 
 int main(int argc, char *const *argv) {
-  int status, socketfd;
+  int status;
 
 #ifdef NDEBUG
 # error Do not disable assertions in this security-critical code !