View | Details | Raw Unified | Return to bug 3049 | Differences between
and this patch

Collapse All | Expand All

(-)a/configure.ac (+3 lines)
Lines 679-684 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) Link Here
679
	AC_CHECK_LIB([sandbox], [sandbox_apply], [
679
	AC_CHECK_LIB([sandbox], [sandbox_apply], [
680
	    SSHDLIBS="$SSHDLIBS -lsandbox"
680
	    SSHDLIBS="$SSHDLIBS -lsandbox"
681
	])
681
	])
682
	AC_CHECK_HEADERS([libproc.h], [
683
	    AC_CHECK_DECLS([proc_pidinfo], [], [], [#include <libproc.h>])
684
	])
682
	;;
685
	;;
683
*-*-dragonfly*)
686
*-*-dragonfly*)
684
	SSHDLIBS="$SSHDLIBS -lcrypt"
687
	SSHDLIBS="$SSHDLIBS -lcrypt"
(-)a/openbsd-compat/bsd-closefrom.c (-1 / +23 lines)
Lines 46-51 Link Here
46
#  include <ndir.h>
46
#  include <ndir.h>
47
# endif
47
# endif
48
#endif
48
#endif
49
#if !defined(HAVE_FCNTL_CLOSEM) && defined(HAVE_LIBPROC_H) && HAVE_DECL_PROC_PIDINFO
50
#include <libproc.h>
51
#endif
49
52
50
#ifndef OPEN_MAX
53
#ifndef OPEN_MAX
51
# define OPEN_MAX	256
54
# define OPEN_MAX	256
Lines 64-69 closefrom(int lowfd) Link Here
64
{
67
{
65
    (void) fcntl(lowfd, F_CLOSEM, 0);
68
    (void) fcntl(lowfd, F_CLOSEM, 0);
66
}
69
}
70
#elif defined(HAVE_LIBPROC_H) && HAVE_DECL_PROC_PIDINFO
71
void
72
closefrom(int lowfd)
73
{
74
    int bufsize, i, n, fd;
75
    pid_t pid;
76
    struct proc_fdinfo *fdinfo_buf;
77
78
    pid = getpid();
79
    bufsize = proc_pidinfo(pid, PROC_PIDLISTFDS, 0, NULL, 0);
80
    if (bufsize <= 0) return;
81
    fdinfo_buf = (struct proc_fdinfo*) malloc(bufsize);
82
    if (fdinfo_buf == NULL) return;
83
    bufsize = proc_pidinfo(pid, PROC_PIDLISTFDS, 0, fdinfo_buf, bufsize);
84
    for (i = 0, n = bufsize / PROC_PIDLISTFD_SIZE; i < n; ++i) {
85
        fd = fdinfo_buf[i].proc_fd;
86
        if (fd >= lowfd) close(fd);
87
    }
88
    free(fdinfo_buf);
89
}
67
#else
90
#else
68
void
91
void
69
closefrom(int lowfd)
92
closefrom(int lowfd)
70
- 

Return to bug 3049