chiark / gitweb /
finalise changelog prep. for cvs-buildpackage
[userv.git] / client.c
index 0af49e868e16926b545ece7e357505fcb84dc828..5f60d0e5cb0d2458b43c80871540812fe5f9dad5 100644 (file)
--- a/client.c
+++ b/client.c
@@ -2,7 +2,7 @@
  * userv - client.c
  * client code
  *
- * Copyright (C)1996-1997,1999 Ian Jackson
+ * Copyright (C)1996-1997,1999-2001,2003 Ian Jackson
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by
@@ -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) {