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

Collapse All | Expand All

(-)a/configure.ac (-2 / +4 lines)
Lines 836-841 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) Link Here
836
	dnl Target SUSv3/POSIX.1-2001 plus BSD specifics.
836
	dnl Target SUSv3/POSIX.1-2001 plus BSD specifics.
837
	dnl _DEFAULT_SOURCE is the new name for _BSD_SOURCE
837
	dnl _DEFAULT_SOURCE is the new name for _BSD_SOURCE
838
	CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE"
838
	CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE"
839
	AC_DEFINE([BROKEN_CLOSEFROM], [1], [broken in chroots on older kernels])
839
	AC_DEFINE([PAM_TTY_KLUDGE], [1],
840
	AC_DEFINE([PAM_TTY_KLUDGE], [1],
840
		[Work around problematic Linux PAM modules handling of PAM_TTY])
841
		[Work around problematic Linux PAM modules handling of PAM_TTY])
841
	AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"],
842
	AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"],
Lines 871-878 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) Link Here
871
# include <sys/types.h>
872
# include <sys/types.h>
872
#endif
873
#endif
873
	    ])
874
	    ])
874
	AC_CHECK_HEADERS([linux/seccomp.h linux/filter.h linux/audit.h], [],
875
	AC_CHECK_HEADERS([linux/seccomp.h linux/filter.h linux/audit.h \
875
	    [], [#include <linux/types.h>])
876
	    linux/close_range.h], [], [], [#include <linux/types.h>])
876
	# Obtain MIPS ABI
877
	# Obtain MIPS ABI
877
	case "$host" in
878
	case "$host" in
878
	mips*)
879
	mips*)
Lines 1817-1822 AC_CHECK_FUNCS([ \ Link Here
1817
	cap_rights_limit \
1818
	cap_rights_limit \
1818
	clock \
1819
	clock \
1819
	closefrom \
1820
	closefrom \
1821
	close_range \
1820
	dirfd \
1822
	dirfd \
1821
	endgrent \
1823
	endgrent \
1822
	err \
1824
	err \
(-)a/openbsd-compat/bsd-closefrom.c (-1 / +9 lines)
Lines 16-22 Link Here
16
16
17
#include "includes.h"
17
#include "includes.h"
18
18
19
#ifndef HAVE_CLOSEFROM
19
#if !defined(HAVE_CLOSEFROM) || defined(BROKEN_CLOSEFROM)
20
20
21
#include <sys/types.h>
21
#include <sys/types.h>
22
#include <sys/param.h>
22
#include <sys/param.h>
Lines 49-54 Link Here
49
#if defined(HAVE_LIBPROC_H)
49
#if defined(HAVE_LIBPROC_H)
50
# include <libproc.h>
50
# include <libproc.h>
51
#endif
51
#endif
52
#if defined(HAVE_LINUX_CLOSE_RANGE_H)
53
# include <linux/close_range.h>
54
#endif
52
55
53
#ifndef OPEN_MAX
56
#ifndef OPEN_MAX
54
# define OPEN_MAX	256
57
# define OPEN_MAX	256
Lines 130-135 closefrom(int lowfd) Link Here
130
    DIR *dirp;
133
    DIR *dirp;
131
    int len;
134
    int len;
132
135
136
#ifdef HAVE_CLOSE_RANGE
137
	if (close_range(lowfd, INT_MAX, 0) == 0)
138
		return;
139
#endif
140
133
    /* Check for a /proc/$$/fd directory. */
141
    /* Check for a /proc/$$/fd directory. */
134
    len = snprintf(fdpath, sizeof(fdpath), "/proc/%ld/fd", (long)getpid());
142
    len = snprintf(fdpath, sizeof(fdpath), "/proc/%ld/fd", (long)getpid());
135
    if (len > 0 && (size_t)len < sizeof(fdpath) && (dirp = opendir(fdpath))) {
143
    if (len > 0 && (size_t)len < sizeof(fdpath) && (dirp = opendir(fdpath))) {

Return to bug 3349