Remove the dependency on fdopendir, which does not exist everywhere.
git-svn-id: https://shellinabox.googlecode.com/svn/trunk@71 0da03de8-d603-11dd-86c2-0f8696b7b6f9
This commit is contained in:
parent
6c0a9cc80c
commit
11cda91356
4 changed files with 10 additions and 11 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2009-02-27 Markus Gutschke <markus@shellinabox.com>
|
||||||
|
|
||||||
|
* Remove the dependency on fdopendir, which does not exist
|
||||||
|
everywhere.
|
||||||
|
|
||||||
2009-02-16 Markus Gutschke <markus@shellinabox.com>
|
2009-02-16 Markus Gutschke <markus@shellinabox.com>
|
||||||
|
|
||||||
* Include VCS revision number in user-visible version string.
|
* Include VCS revision number in user-visible version string.
|
||||||
|
|
2
aclocal.m4
vendored
2
aclocal.m4
vendored
|
@ -21,7 +21,7 @@ To do so, use the procedure documented by the package, typically `autoreconf'.])
|
||||||
|
|
||||||
# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
|
# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
|
||||||
|
|
||||||
# serial 52 Debian 1.5.26-4 AC_PROG_LIBTOOL
|
# serial 52 Debian 1.5.26-1ubuntu1 AC_PROG_LIBTOOL
|
||||||
|
|
||||||
|
|
||||||
# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
|
# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
|
||||||
|
|
2
config.h
2
config.h
|
@ -95,7 +95,7 @@
|
||||||
#define STDC_HEADERS 1
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
/* Most recent revision number in the version control system */
|
/* Most recent revision number in the version control system */
|
||||||
#define VCS_REVISION "68"
|
#define VCS_REVISION "71"
|
||||||
|
|
||||||
/* Version number of package */
|
/* Version number of package */
|
||||||
#define VERSION "2.4"
|
#define VERSION "2.4"
|
||||||
|
|
|
@ -132,10 +132,6 @@ static int (*x_misc_conv)(int, const struct pam_message **,
|
||||||
#define misc_conv x_misc_conv
|
#define misc_conv x_misc_conv
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Older versions of glibc might not support fdopendir(). That's OK, we can
|
|
||||||
// work around the lack of it, at a small performance loss.
|
|
||||||
extern DIR *fdopendir(int) __attribute__((weak));
|
|
||||||
|
|
||||||
static int launcher = -1;
|
static int launcher = -1;
|
||||||
static uid_t restricted;
|
static uid_t restricted;
|
||||||
|
|
||||||
|
@ -485,8 +481,8 @@ void closeAllFds(int *exceptFds, int num) {
|
||||||
// Close all file handles. If possible, scan through "/proc/self/fd" as
|
// Close all file handles. If possible, scan through "/proc/self/fd" as
|
||||||
// that is faster than calling close() on all possible file handles.
|
// that is faster than calling close() on all possible file handles.
|
||||||
int nullFd = open("/dev/null", O_RDWR);
|
int nullFd = open("/dev/null", O_RDWR);
|
||||||
int dirFd = !&fdopendir ? -1 : open("/proc/self/fd", O_RDONLY);
|
DIR *dir = opendir("/proc/self/fd");
|
||||||
if (dirFd < 0) {
|
if (dir == 0) {
|
||||||
for (int i = sysconf(_SC_OPEN_MAX); --i > 0; ) {
|
for (int i = sysconf(_SC_OPEN_MAX); --i > 0; ) {
|
||||||
if (i != nullFd) {
|
if (i != nullFd) {
|
||||||
for (int j = 0; j < num; j++) {
|
for (int j = 0; j < num; j++) {
|
||||||
|
@ -505,14 +501,12 @@ void closeAllFds(int *exceptFds, int num) {
|
||||||
no_close_1:;
|
no_close_1:;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DIR *dir;
|
|
||||||
check(dir = fdopendir(dirFd));
|
|
||||||
struct dirent de, *res;
|
struct dirent de, *res;
|
||||||
while (!readdir_r(dir, &de, &res) && res) {
|
while (!readdir_r(dir, &de, &res) && res) {
|
||||||
if (res->d_name[0] < '0')
|
if (res->d_name[0] < '0')
|
||||||
continue;
|
continue;
|
||||||
int fd = atoi(res->d_name);
|
int fd = atoi(res->d_name);
|
||||||
if (fd != nullFd && fd != dirFd) {
|
if (fd != nullFd && fd != dirfd(dir)) {
|
||||||
for (int j = 0; j < num; j++) {
|
for (int j = 0; j < num; j++) {
|
||||||
if (fd == exceptFds[j]) {
|
if (fd == exceptFds[j]) {
|
||||||
goto no_close_2;
|
goto no_close_2;
|
||||||
|
|
Loading…
Reference in a new issue