[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/7] killall5.c: Use sysconf(_SC_SYMLOOP_MAX) instead of MAXSYMLI
From: |
Justus Winter |
Subject: |
[PATCH 6/7] killall5.c: Use sysconf(_SC_SYMLOOP_MAX) instead of MAXSYMLINKS. |
Date: |
Thu, 15 Aug 2013 09:45:33 +0200 |
If sysconf returns an error, fall back to MAXSYMLINKS on platforms
that define it.
Fixes build on Hurd.
---
debian/changelog | 2 ++
src/killall5.c | 15 ++++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index ce16030..dd1861d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -60,6 +60,8 @@ sysvinit (2.88dsf-42) UNRELEASED; urgency=low
only recently.
* checkroot.sh: Only run rootcheck on Linux. Neither kFreeBSD nor Hurd
have /dev/root and the device ids used here are specific to Linux.
+ * killall5.c: Use sysconf(_SC_SYMLOOP_MAX) instead of MAXSYMLINKS.
+ Fixes build on Hurd.
-- Roger Leigh <rleigh@debian.org> Sat, 04 May 2013 13:13:51 +0100
diff --git a/src/killall5.c b/src/killall5.c
index 5937d98..2c9bb4f 100644
--- a/src/killall5.c
+++ b/src/killall5.c
@@ -367,13 +367,26 @@ out:
}
/*
+ * Get the maximal number of symlinks to follow.
+ */
+static int maxsymlinks(void)
+{
+ int v = sysconf(_SC_SYMLOOP_MAX);
+#ifdef MAXSYMLINKS
+ if (v == -1)
+ return MAXSYMLINKS;
+#endif
+ return v;
+}
+
+/*
* Check path is located on a network based partition.
*/
int check4nfs(const char * path, char * real)
{
char buf[PATH_MAX+1];
const char *curr;
- int deep = MAXSYMLINKS;
+ int deep = maxsymlinks();
if (!nlist) return 0;
--
1.7.10.4
- patches for sysvinit (2), Justus Winter, 2013/08/15
- [PATCH 1/7] initscripts: hurd has a proper tmpfs now, remove workaround, Justus Winter, 2013/08/15
- [PATCH 2/7] initscripts: add -ocompatible to procfs mounts on Hurd, Justus Winter, 2013/08/15
- [PATCH 3/7] initscripts: use pidof -s /sbin/init for robustness, Justus Winter, 2013/08/15
- [PATCH 6/7] killall5.c: Use sysconf(_SC_SYMLOOP_MAX) instead of MAXSYMLINKS.,
Justus Winter <=
- [PATCH 4/7] initscripts: add runsystem.sysv, Justus Winter, 2013/08/15
- [PATCH 5/7] initscripts: Only run rootcheck on Linux, Justus Winter, 2013/08/15
- [PATCH 7/7] sysvinit: Fix getty path in /etc/inittab on Hurd., Justus Winter, 2013/08/15
- Re: patches for sysvinit (2), Samuel Thibault, 2013/08/28