- (dtucker) [configure.ac openbsd-compat/bsd-closefrom.c] Resync with
closefrom.c from sudo.
This commit is contained in:
parent
c889ffdbc6
commit
d018b2e9c8
|
@ -1,3 +1,7 @@
|
||||||
|
20060818
|
||||||
|
- (dtucker) [configure.ac openbsd-compat/bsd-closefrom.c] Resync with
|
||||||
|
closefrom.c from sudo.
|
||||||
|
|
||||||
20060817
|
20060817
|
||||||
- (dtucker) [openbsd-compat/fake-rfc2553.c openbsd-compat/setproctitle.c]
|
- (dtucker) [openbsd-compat/fake-rfc2553.c openbsd-compat/setproctitle.c]
|
||||||
Include stdlib.h for malloc and friends.
|
Include stdlib.h for malloc and friends.
|
||||||
|
@ -5218,4 +5222,4 @@
|
||||||
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
|
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
|
||||||
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
|
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.4482 2006/08/17 09:40:35 dtucker Exp $
|
$Id: ChangeLog,v 1.4483 2006/08/18 08:51:20 dtucker Exp $
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: configure.ac,v 1.349 2006/08/17 09:35:49 dtucker Exp $
|
# $Id: configure.ac,v 1.350 2006/08/18 08:51:20 dtucker Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 1999-2004 Damien Miller
|
# Copyright (c) 1999-2004 Damien Miller
|
||||||
#
|
#
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
|
AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
|
||||||
AC_REVISION($Revision: 1.349 $)
|
AC_REVISION($Revision: 1.350 $)
|
||||||
AC_CONFIG_SRCDIR([ssh.c])
|
AC_CONFIG_SRCDIR([ssh.c])
|
||||||
|
|
||||||
AC_CONFIG_HEADER(config.h)
|
AC_CONFIG_HEADER(config.h)
|
||||||
|
@ -181,7 +181,7 @@ case "$host" in
|
||||||
)
|
)
|
||||||
AC_CHECK_FUNCS(setauthdb)
|
AC_CHECK_FUNCS(setauthdb)
|
||||||
AC_CHECK_DECL(F_CLOSEM,
|
AC_CHECK_DECL(F_CLOSEM,
|
||||||
AC_DEFINE(USE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]),
|
AC_DEFINE(HAVE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]),
|
||||||
[],
|
[],
|
||||||
[ #include <limits.h>
|
[ #include <limits.h>
|
||||||
#include <fcntl.h> ]
|
#include <fcntl.h> ]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2004 Todd C. Miller <Todd.Miller@courtesan.com>
|
* Copyright (c) 2004-2005 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -52,12 +52,19 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char sudorcsid[] = "$Sudo: closefrom.c,v 1.6 2004/06/01 20:51:56 millert Exp $";
|
__unused static const char rcsid[] = "$Sudo: closefrom.c,v 1.11 2006/08/17 15:26:54 millert Exp $";
|
||||||
#endif /* lint */
|
#endif /* lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Close all file descriptors greater than or equal to lowfd.
|
* Close all file descriptors greater than or equal to lowfd.
|
||||||
*/
|
*/
|
||||||
|
#ifdef HAVE_FCNTL_CLOSEM
|
||||||
|
void
|
||||||
|
closefrom(int lowfd)
|
||||||
|
{
|
||||||
|
(void) fcntl(lowfd, F_CLOSEM, 0);
|
||||||
|
}
|
||||||
|
#else
|
||||||
void
|
void
|
||||||
closefrom(int lowfd)
|
closefrom(int lowfd)
|
||||||
{
|
{
|
||||||
|
@ -70,7 +77,7 @@ closefrom(int lowfd)
|
||||||
|
|
||||||
/* Check for a /proc/$$/fd directory. */
|
/* Check for a /proc/$$/fd directory. */
|
||||||
len = snprintf(fdpath, sizeof(fdpath), "/proc/%ld/fd", (long)getpid());
|
len = snprintf(fdpath, sizeof(fdpath), "/proc/%ld/fd", (long)getpid());
|
||||||
if (len >= 0 && (u_int)len <= sizeof(fdpath) && (dirp = opendir(fdpath))) {
|
if (len > 0 && (size_t)len <= sizeof(fdpath) && (dirp = opendir(fdpath))) {
|
||||||
while ((dent = readdir(dirp)) != NULL) {
|
while ((dent = readdir(dirp)) != NULL) {
|
||||||
fd = strtol(dent->d_name, &endp, 10);
|
fd = strtol(dent->d_name, &endp, 10);
|
||||||
if (dent->d_name != endp && *endp == '\0' &&
|
if (dent->d_name != endp && *endp == '\0' &&
|
||||||
|
@ -79,10 +86,6 @@ closefrom(int lowfd)
|
||||||
}
|
}
|
||||||
(void) closedir(dirp);
|
(void) closedir(dirp);
|
||||||
} else
|
} else
|
||||||
#elif defined(USE_FCNTL_CLOSEM)
|
|
||||||
if (fcntl(lowfd, F_CLOSEM, 0) != -1) {
|
|
||||||
return;
|
|
||||||
} else
|
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -102,6 +105,5 @@ closefrom(int lowfd)
|
||||||
(void) close((int) fd);
|
(void) close((int) fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* !HAVE_FCNTL_CLOSEM */
|
||||||
#endif /* HAVE_CLOSEFROM */
|
#endif /* HAVE_CLOSEFROM */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue