From 5f08476e3bc5c134ce57d924b01d1c1fcacd53db Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Sat, 24 Mar 2012 12:28:35 +0100 Subject: [PATCH] closefds() doesn't seem relevant or large enough to be a function. I should beware in-sourcing too much ... --- h/prototypes.h | 1 - sbr/Makefile.in | 2 +- sbr/closefds.c | 19 ------------------- uip/repl.c | 6 ++++-- uip/send.c | 5 ++++- uip/slocal.c | 6 ++++-- 6 files changed, 13 insertions(+), 26 deletions(-) delete mode 100644 sbr/closefds.c diff --git a/h/prototypes.h b/h/prototypes.h index 528da47..b05535d 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -29,7 +29,6 @@ void advise(char *, char *, ...); void ambigsw(char *, struct swit *); char **brkstring(char *, char *, char *); int check_charset(char *, int); -void closefds(int); char *concat(char *, ...); int context_del(char *); char *context_find(char *); diff --git a/sbr/Makefile.in b/sbr/Makefile.in index 5b40ab3..d96807c 100644 --- a/sbr/Makefile.in +++ b/sbr/Makefile.in @@ -46,7 +46,7 @@ SIGNAL_H = @SIGNAL_H@ # source for library functions SRCS = addrsbr.c ambigsw.c brkstring.c \ - check_charset.c closefds.c concat.c context_del.c \ + check_charset.c concat.c context_del.c \ context_find.c context_foil.c context_read.c \ context_replace.c context_save.c \ copyip.c cpydata.c cpydgst.c crawl_folders.c \ diff --git a/sbr/closefds.c b/sbr/closefds.c deleted file mode 100644 index 8a4da49..0000000 --- a/sbr/closefds.c +++ /dev/null @@ -1,19 +0,0 @@ -/* -** closefds.c -- close-up fd's -** -** This code is Copyright (c) 2002, by the authors of nmh. See the -** COPYRIGHT file in the root directory of the nmh distribution for -** complete copyright information. -*/ - -#include - - -void -closefds(int i) -{ - int nbits = OPEN_MAX; - - for (; i < nbits; i++) - close(i); -} diff --git a/uip/repl.c b/uip/repl.c index be4eb40..3c9e483 100644 --- a/uip/repl.c +++ b/uip/repl.c @@ -766,7 +766,7 @@ insert(struct mailname *np) static void replfilter(FILE *in, FILE *out, char *filter) { - int pid; + int pid, n; char *errstr; if (filter == NULL) @@ -785,7 +785,9 @@ replfilter(FILE *in, FILE *out, char *filter) case OK: dup2(fileno(in), fileno(stdin)); dup2(fileno(out), fileno(stdout)); - closefds(3); + for (n=3; n