diff options
author | Damien Miller <djm@mindrot.org> | 2004-08-15 18:40:59 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2004-08-15 18:40:59 +1000 |
commit | 36f496502072d82dbb202b41a199eb6032557710 (patch) | |
tree | 439092c6479cb2fea8c09318b37a61370d860638 /openbsd-compat/bsd-misc.c | |
parent | 25f60a7ee780c2cd4a01e05698149d274821012f (diff) |
- (djm) [acconfig.h configure.ac openbsd-compat/Makefile.in
openbsd-compat/bsd-closefrom.c openbsd-compat/bsd-misc.c
openbsd-compat/bsd-misc.h openbsd-compat/openbsd-compat.h] Use smarter
closefrom() replacement from sudo; ok dtucker@
Diffstat (limited to 'openbsd-compat/bsd-misc.c')
-rw-r--r-- | openbsd-compat/bsd-misc.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c index 3a30b6e4f..1b276b4f4 100644 --- a/openbsd-compat/bsd-misc.c +++ b/openbsd-compat/bsd-misc.c | |||
@@ -1,3 +1,4 @@ | |||
1 | |||
1 | /* | 2 | /* |
2 | * Copyright (c) 1999-2004 Damien Miller <djm@mindrot.org> | 3 | * Copyright (c) 1999-2004 Damien Miller <djm@mindrot.org> |
3 | * | 4 | * |
@@ -17,7 +18,7 @@ | |||
17 | #include "includes.h" | 18 | #include "includes.h" |
18 | #include "xmalloc.h" | 19 | #include "xmalloc.h" |
19 | 20 | ||
20 | RCSID("$Id: bsd-misc.c,v 1.24 2004/08/13 08:37:21 dtucker Exp $"); | 21 | RCSID("$Id: bsd-misc.c,v 1.25 2004/08/15 08:41:00 djm Exp $"); |
21 | 22 | ||
22 | #ifndef HAVE___PROGNAME | 23 | #ifndef HAVE___PROGNAME |
23 | char *__progname; | 24 | char *__progname; |
@@ -196,22 +197,6 @@ tcsendbreak(int fd, int duration) | |||
196 | } | 197 | } |
197 | #endif /* HAVE_TCSENDBREAK */ | 198 | #endif /* HAVE_TCSENDBREAK */ |
198 | 199 | ||
199 | #ifndef HAVE_CLOSEFROM | ||
200 | int | ||
201 | closefrom(int fd) | ||
202 | { | ||
203 | int i, result = 0, err = 0; | ||
204 | |||
205 | for (i = fd; i < 128; i++) | ||
206 | if (close(i) != 0) { | ||
207 | err = errno; | ||
208 | result = -1; | ||
209 | } | ||
210 | errno = err; | ||
211 | return result; | ||
212 | } | ||
213 | #endif /* HAVE_CLOSEFROM */ | ||
214 | |||
215 | mysig_t | 200 | mysig_t |
216 | mysignal(int sig, mysig_t act) | 201 | mysignal(int sig, mysig_t act) |
217 | { | 202 | { |