summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--configure.ac6
-rw-r--r--openbsd-compat/bsd-misc.c18
-rw-r--r--openbsd-compat/bsd-misc.h6
4 files changed, 28 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index e6903097c..87659375b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,8 @@
- djm@cvs.openbsd.org 2004/06/25 01:25:12
[regress/test-exec.sh]
clean reexec-specific junk out of text-exec.sh and simplify; idea markus@
+ - (dtucker) [configure.ac openbsd-compat/misc.c [openbsd-compat/misc.h]
+ Add closefrom() for platforms that don't have it.
20040623
- (dtucker) [auth1.c] Ensure do_pam_account is called for Protocol 1
@@ -1416,4 +1418,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
-$Id: ChangeLog,v 1.3447 2004/06/25 03:46:08 dtucker Exp $
+$Id: ChangeLog,v 1.3448 2004/06/25 04:03:34 dtucker Exp $
diff --git a/configure.ac b/configure.ac
index 88c0c4687..1bf3ca66f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-# $Id: configure.ac,v 1.221 2004/06/20 17:37:32 tim Exp $
+# $Id: configure.ac,v 1.222 2004/06/25 04:03:34 dtucker Exp $
#
# Copyright (c) 1999-2004 Damien Miller
#
@@ -830,8 +830,8 @@ AC_ARG_WITH(tcp-wrappers,
dnl Checks for library functions. Please keep in alphabetical order
AC_CHECK_FUNCS(\
- arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
- bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
+ arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \
+ bindresvport_sa clock closefrom fchmod fchown freeaddrinfo futimes \
getaddrinfo getcwd getgrouplist getnameinfo getopt \
getpeereid _getpty getrlimit getttyent glob inet_aton \
inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
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 @@
#include "includes.h"
#include "xmalloc.h"
-RCSID("$Id: bsd-misc.c,v 1.21 2004/02/17 05:49:55 djm Exp $");
+RCSID("$Id: bsd-misc.c,v 1.22 2004/06/25 04:03:34 dtucker Exp $");
/*
* NB. duplicate __progname in case it is an alias for argv[0]
@@ -192,6 +192,22 @@ tcsendbreak(int fd, int duration)
}
#endif /* HAVE_TCSENDBREAK */
+#ifndef HAVE_CLOSEFROM
+int
+closefrom(int fd)
+{
+ int i, result = 0, err = 0;
+
+ for (i = fd; i < 128; i++)
+ if (close(i) != 0) {
+ err = errno;
+ result = -1;
+ }
+ errno = err;
+ return result;
+}
+#endif /* HAVE_CLOSEFROM */
+
mysig_t
mysignal(int sig, mysig_t act)
{
diff --git a/openbsd-compat/bsd-misc.h b/openbsd-compat/bsd-misc.h
index 009739b14..7027815d6 100644
--- a/openbsd-compat/bsd-misc.h
+++ b/openbsd-compat/bsd-misc.h
@@ -1,4 +1,4 @@
-/* $Id: bsd-misc.h,v 1.15 2004/03/08 11:59:03 dtucker Exp $ */
+/* $Id: bsd-misc.h,v 1.16 2004/06/25 04:03:34 dtucker Exp $ */
/*
* Copyright (c) 1999-2004 Damien Miller <djm@mindrot.org>
@@ -93,6 +93,10 @@ int tcsendbreak(int, int);
void unsetenv(const char *);
#endif
+#ifndef HAVE_CLOSEFROM
+int closefrom(int);
+#endif
+
/* wrapper for signal interface */
typedef void (*mysig_t)(int);
mysig_t mysignal(int sig, mysig_t act);