Package: gidentd
Version: 0.4.5
Severity: important
Tags: patch
Hi!
gidentd fails to build on GNU/kFreeBSD because it uses a Linux-specific macro
to obtain the maximum number of fds.
A patch to close all fds portably is attached.
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: kfreebsd-i386 (i586)
Shell: /bin/sh linked to /bin/bash
Kernel: GNU/kFreeBSD 5.3-11
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)
diff -ur gidentd-0.4.5.old/system.c gidentd-0.4.5/system.c
--- gidentd-0.4.5.old/system.c 2001-12-23 01:57:50.000000000 +0100
+++ gidentd-0.4.5/system.c 2005-07-04 22:35:31.000000000 +0200
@@ -5,7 +5,6 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <linux/limits.h>
#include <signal.h>
#include <wait.h>
#include <pwd.h>
@@ -35,12 +34,18 @@
return(0);
}
+#if defined(_SC_OPEN_MAX)
+# define maxfd sysconf (_SC_OPEN_MAX)
+#elif defined(OPEN_MAX)
+# define maxfd OPEN_MAX
+#endif
+
// close open files
void CloseFiles(int f)
{
int i;
- for(i=f; i<NR_OPEN; i++) close(i);
+ for(i=f; i<maxfd; i++) close(i);
}
// delete my pidfile