chiark / gitweb /
@@ -1,3 +1,9 @@
[userv.git] / client.c
index 0af49e868e16926b545ece7e357505fcb84dc828..60869b09af0d3478b3fb74ca87fd53d1040fece8 100644 (file)
--- a/client.c
+++ b/client.c
@@ -1164,7 +1164,7 @@ static void prepare_asynchsignals(void) {
 }
 
 
-static void cat_close_unwanted_pipes(void) {
+static void close_unwanted_pipes(void) {
   int fd;
 
   for (fd=0; fd<fdsetupsize; fd++) {
@@ -1220,15 +1220,13 @@ 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);
-      cat_close_unwanted_pipes();
+      close_unwanted_pipes();
       execl("/bin/cat",catnamebuf,(char*)0);
       fprintf(stderr,"userv: %s: cannot exec `cat': %s\n",catnamebuf,strerror(errno));
       exit(-1);
     }
-    if (fdsetup[fd].copyfd>2)
-      if (close(fdsetup[fd].copyfd)) fsyscallerror("close real fd for %d",fd);
-    if (close(fdsetup[fd].pipefd)) fsyscallerror("close pipe fd for %d",fd);
   }
+  close_unwanted_pipes();
 }
 
 static void server_sendconfirm(void) {