+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>
* Include VCS revision number in user-visible version string.
# 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)
#define STDC_HEADERS 1
/* Most recent revision number in the version control system */
-#define VCS_REVISION "68"
+#define VCS_REVISION "71"
/* Version number of package */
#define VERSION "2.4"
#define misc_conv x_misc_conv
#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 uid_t restricted;
// Close all file handles. If possible, scan through "/proc/self/fd" as
// that is faster than calling close() on all possible file handles.
int nullFd = open("/dev/null", O_RDWR);
- int dirFd = !&fdopendir ? -1 : open("/proc/self/fd", O_RDONLY);
- if (dirFd < 0) {
+ DIR *dir = opendir("/proc/self/fd");
+ if (dir == 0) {
for (int i = sysconf(_SC_OPEN_MAX); --i > 0; ) {
if (i != nullFd) {
for (int j = 0; j < num; j++) {
no_close_1:;
}
} else {
- DIR *dir;
- check(dir = fdopendir(dirFd));
struct dirent de, *res;
while (!readdir_r(dir, &de, &res) && res) {
if (res->d_name[0] < '0')
continue;
int fd = atoi(res->d_name);
- if (fd != nullFd && fd != dirFd) {
+ if (fd != nullFd && fd != dirfd(dir)) {
for (int j = 0; j < num; j++) {
if (fd == exceptFds[j]) {
goto no_close_2;