- (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).
This commit is contained in:
Darren Tucker 2004-06-25 14:03:34 +10:00
parent ef3b47a73a
commit 60bd4098f6
4 changed files with 28 additions and 6 deletions

View File

@ -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 $

View File

@ -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 \

View File

@ -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)
{

View File

@ -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);