summaryrefslogtreecommitdiff
path: root/openbsd-compat/bsd-misc.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-06-25 14:03:34 +1000
committerDarren Tucker <dtucker@zip.com.au>2004-06-25 14:03:34 +1000
commit60bd4098f64fd0fbbd9b6b4de2562623318141a0 (patch)
tree7dc6caa88aa1c03ed6a760855c48f24a0c5570cb /openbsd-compat/bsd-misc.c
parentef3b47a73adf98a510200daea9ebfceebed5bed6 (diff)
- (dtucker) [configure.ac openbsd-compat/misc.c [openbsd-compat/misc.h]
Add closefrom() for platforms that don't have it. (might need some tuning later, but I want to be able to test reexec).
Diffstat (limited to 'openbsd-compat/bsd-misc.c')
-rw-r--r--openbsd-compat/bsd-misc.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c
index 7b06786f5..c58cce0f4 100644
--- a/openbsd-compat/bsd-misc.c
+++ b/openbsd-compat/bsd-misc.c
@@ -17,7 +17,7 @@
17#include "includes.h" 17#include "includes.h"
18#include "xmalloc.h" 18#include "xmalloc.h"
19 19
20RCSID("$Id: bsd-misc.c,v 1.21 2004/02/17 05:49:55 djm Exp $"); 20RCSID("$Id: bsd-misc.c,v 1.22 2004/06/25 04:03:34 dtucker Exp $");
21 21
22/* 22/*
23 * NB. duplicate __progname in case it is an alias for argv[0] 23 * NB. duplicate __progname in case it is an alias for argv[0]
@@ -192,6 +192,22 @@ tcsendbreak(int fd, int duration)
192} 192}
193#endif /* HAVE_TCSENDBREAK */ 193#endif /* HAVE_TCSENDBREAK */
194 194
195#ifndef HAVE_CLOSEFROM
196int
197closefrom(int fd)
198{
199 int i, result = 0, err = 0;
200
201 for (i = fd; i < 128; i++)
202 if (close(i) != 0) {
203 err = errno;
204 result = -1;
205 }
206 errno = err;
207 return result;
208}
209#endif /* HAVE_CLOSEFROM */
210
195mysig_t 211mysig_t
196mysignal(int sig, mysig_t act) 212mysignal(int sig, mysig_t act)
197{ 213{