On Wed, Apr 28, 2010 at 07:23:49AM +0200, Petter Reinholdtsen wrote:
> The new code fail to build on Debian/Hurd. The complete build log is
> available from
> <URL:https://buildd.debian.org/fetch.cgi?pkg=sysvinit&arch=hurd-i386&ver=2.88dsf-2&stamp=1272429666&file=log&as=raw>,
> and the relevant part is:
>
> cc -g -O2 -W -Wall -D_GNU_SOURCE -DACCTON_OFF killall5.c -o killall5
> killall5.c: In function 'check4nfs':
> killall5.c:374: error: 'PATH_MAX' undeclared (first use in this function)
> killall5.c:374: error: (Each undeclared identifier is reported only once
> killall5.c:374: error: for each function it appears in.)
> killall5.c:374: warning: unused variable 'buf'
> killall5.c: In function 'readproc':
> killall5.c:457: error: 'PATH_MAX' undeclared (first use in this function)
> killall5.c:458: warning: unused variable 'buf'
> killall5.c:457: warning: unused variable 'path'
> killall5.c: In function 'pidof':
> killall5.c:690: error: 'PATH_MAX' undeclared (first use in this function)
> killall5.c:746: warning: left-hand operand of comma expression has no effect
> killall5.c:746: warning: left-hand operand of comma expression has no effect
> killall5.c:738: warning: unused variable 'path'
> killall5.c:737: warning: unused variable 'exe'
> killall5.c:690: warning: unused variable 'real'
>
> Werner, any preferences on how to fix this?
Maybe a line like this
#include <limits.h>
may solve the problem, after this we could use
#ifndef PATH_MAX
# ifdef MAXPATHLEN
# define PATH_MAX MAXPATHLEN
# else
# define PATH_MAX 2048
# endif
#endif
that should work on all systems out there.
Please try out the attached patch.
Werner
--
"Having a smoking section in a restaurant is like having
a peeing section in a swimming pool." -- Edward Burr
Index: src/killall5.c
===================================================================
--- src/killall5.c (revision 68)
+++ src/killall5.c (working copy)
@@ -43,6 +43,7 @@
#include <dirent.h>
#include <errno.h>
#include <getopt.h>
+#include <limits.h>
#include <mntent.h>
#include <stdarg.h>
#include <stdio.h>
@@ -59,6 +60,14 @@
char *Version = "@(#)killall5 2.86 31-Jul-2004 [email protected]";
+#ifndef PATH_MAX
+# ifdef MAXPATHLEN
+# define PATH_MAX MAXPATHLEN
+# else
+# define PATH_MAX 2048
+# endif
+#endif
+
#define STATNAMELEN 15
#define DO_NETFS 2
#define DO_STAT 1