X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=client.c;h=520928f9d42e5c87056cc5912b1a13167a84ae81;hb=dc274b4da5f5c358ac93d298b23d2a96dbe7b3de;hp=ab3ae6f0fb1e33fd16c8b6bba4ae1285f257229e;hpb=dcadbc2296660082203ef157f1fd333a7b2e1675;p=userv.git diff --git a/client.c b/client.c index ab3ae6f..520928f 100644 --- 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"); @@ -1160,7 +1161,7 @@ static void prepare_asynchsignals(void) { if (sigaction(SIGALRM,&sig,0)) syscallerror("set up sigalrm handler"); if (!timeout) return; - if (alarm(timeout)<0) syscallerror("set up timeout alarm"); + alarm(timeout); } @@ -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 !