From 3083bc2b52fe00b5c5fe87dd3638969835dab0e8 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Thu, 17 Aug 2006 19:35:49 +1000 Subject: [PATCH] - (dtucker) [configure.ac openbsd-compat/bsd-closefrom.c] Use F_CLOSEM fcntl for closefrom() on AIX. Pointed out by William Ahern. --- ChangeLog | 4 +++- configure.ac | 10 ++++++++-- openbsd-compat/bsd-closefrom.c | 7 +++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 911fd3716..3f253c021 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 20060817 - (dtucker) [openbsd-compat/fake-rfc2553.c openbsd-compat/setproctitle.c] Include stdlib.h for malloc and friends. + - (dtucker) [configure.ac openbsd-compat/bsd-closefrom.c] Use F_CLOSEM fcntl + for closefrom() on AIX. Pointed out by William Ahern. 20060816 - (djm) [audit-bsm.c] Sprinkle in some headers @@ -5214,4 +5216,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.4480 2006/08/17 08:55:27 dtucker Exp $ +$Id: ChangeLog,v 1.4481 2006/08/17 09:35:49 dtucker Exp $ diff --git a/configure.ac b/configure.ac index 31dac052e..7a296ae8b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.348 2006/08/04 09:44:23 dtucker Exp $ +# $Id: configure.ac,v 1.349 2006/08/17 09:35:49 dtucker Exp $ # # Copyright (c) 1999-2004 Damien Miller # @@ -15,7 +15,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org) -AC_REVISION($Revision: 1.348 $) +AC_REVISION($Revision: 1.349 $) AC_CONFIG_SRCDIR([ssh.c]) AC_CONFIG_HEADER(config.h) @@ -180,6 +180,12 @@ case "$host" in [#include ] ) AC_CHECK_FUNCS(setauthdb) + AC_CHECK_DECL(F_CLOSEM, + AC_DEFINE(USE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]), + [], + [ #include + #include ] + ) check_for_aix_broken_getaddrinfo=1 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.]) AC_DEFINE(SETEUID_BREAKS_SETUID, 1, diff --git a/openbsd-compat/bsd-closefrom.c b/openbsd-compat/bsd-closefrom.c index 3f17302d1..e7a521e43 100644 --- a/openbsd-compat/bsd-closefrom.c +++ b/openbsd-compat/bsd-closefrom.c @@ -22,6 +22,9 @@ #include #include #include +#ifdef HAVE_FCNTL_H +# include +#endif #include #include #include @@ -76,6 +79,10 @@ closefrom(int lowfd) } (void) closedir(dirp); } else +#elif defined(USE_FCNTL_CLOSEM) + if (fcntl(lowfd, F_CLOSEM, 0) != -1) { + return; + } else #endif { /*