From 5d34927984e68ce6bd35119c70eccbf169113598 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@hadrons.org>
Date: Thu, 18 Jul 2019 00:00:15 +0200
Subject: [PATCH acl 1/8] Remove PATH_MAX usage which does not exist on
 GNU/Hurd

The Hurd is intended to have no hardcoded limits, and POSIX makes it
possible for a system to not define PATH_MAX. Switch to the simpler
solution which is to generate the constants at compile time.
---
 test/test_group.c  | 6 +-----
 test/test_passwd.c | 7 +------
 tools/parse.c      | 5 -----
 3 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/test/test_group.c b/test/test_group.c
index 00c0027..6ca761a 100644
--- a/test/test_group.c
+++ b/test/test_group.c
@@ -9,12 +9,8 @@
 #include <grp.h>
 
 #define TEST_GROUP "test/test.group"
-static char grfile[PATH_MAX];
-static void setup_grfile() __attribute__((constructor));
+static char grfile[] = BASEDIR "/" TEST_GROUP;
 
-static void setup_grfile() {
-	snprintf(grfile, sizeof(grfile), "%s/%s", BASEDIR, TEST_GROUP);
-}
 
 #define ALIGN_MASK(x, mask)    (((x) + (mask)) & ~(mask))
 #define ALIGN(x, a)            ALIGN_MASK(x, (typeof(x))(a) - 1)
diff --git a/test/test_passwd.c b/test/test_passwd.c
index 890e041..9a6dad5 100644
--- a/test/test_passwd.c
+++ b/test/test_passwd.c
@@ -9,12 +9,7 @@
 #include <pwd.h>
 
 #define TEST_PASSWD "test/test.passwd"
-static char pwfile[PATH_MAX];
-static void setup_pwfile() __attribute__((constructor));
-
-static void setup_pwfile() {
-	snprintf(pwfile, sizeof(pwfile), "%s/%s", BASEDIR, TEST_PASSWD);
-}
+static char pwfile[] = BASEDIR "/" TEST_PASSWD;
 
 #define ALIGN_MASK(x, mask)    (((x) + (mask)) & ~(mask))
 #define ALIGN(x, a)            ALIGN_MASK(x, (typeof(x))(a) - 1)
diff --git a/tools/parse.c b/tools/parse.c
index 9ddbafb..f85a77b 100644
--- a/tools/parse.c
+++ b/tools/parse.c
@@ -413,11 +413,6 @@ read_acl_comments(
 	mode_t *flags)
 {
 	int c;
-	/*
-	  Max PATH_MAX bytes even for UTF-8 path names and additional 9
-	  bytes for "# file: ". Not a good solution but for now it is the
-	  best I can do without too much impact on the code. [tw]
-	*/
 	char *line, *cp, *p;
 	int comments_read = 0;
 	
-- 
2.22.0.657.g960e92d24f

