summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/acl-hurd-path-max.patch
blob: 89cb3a38d766fdf60b01366044463b90f7607f66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=636512

From: Svante Signell <srs@kth.se>
Subject: acl: Fix FTBFS on hurd-i386
Date: Wed, 03 Aug 2011 19:36:27 +0200

Currently acl does not compile on hurd-i386. The problem is a PATH_MAX
definition which is not supported on GNU/Hurd.

Index: acl-2.2.52/setfacl/parse.c
===================================================================
--- acl-2.2.52/setfacl/parse.c
+++ acl-2.2.52/setfacl/parse.c
@@ -419,7 +419,13 @@ read_acl_comments(
 	  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]
 	*/
+
+#ifdef __GNU__
+	char *linebuf;
+	size_t dummy = 0;
+#else
 	char linebuf[(4*PATH_MAX)+9];
+#endif
 	char *cp;
 	char *p;
 	int comments_read = 0;
@@ -449,9 +455,13 @@ read_acl_comments(
 		if (line)
 			(*line)++;
 
+#ifdef __GNU__
+		if (getline(&linebuf, &dummy, file) == -1)
+			break;
+#else
 		if (fgets(linebuf, sizeof(linebuf), file) == NULL)
 			break;
-		
+#endif		
 		comments_read = 1;
 
 		p = strrchr(linebuf, '\0');
@@ -473,7 +483,12 @@ read_acl_comments(
 					goto fail;
 				*path_p = (char*)malloc(strlen(cp)+1);
 				if (!*path_p)
+				  {
+#ifdef __GNU__
+				    free (linebuf);
+#endif
 					return -1;
+				  }
 				strcpy(*path_p, cp);
 			}
 		} else if (strncmp(cp, "owner:", 6) == 0) {
@@ -522,13 +537,24 @@ read_acl_comments(
 		}
 	}
 	if (ferror(file))
+	  {
+#ifdef __GNU__
+	    free (linebuf);
+#endif
 		return -1;
+	  }
+#ifdef __GNU__
+	free (linebuf);
+#endif
 	return comments_read;
 fail:
 	if (path_p && *path_p) {
 		free(*path_p);
 		*path_p = NULL;
 	}
+#ifdef __GNU__
+	free (linebuf);
+#endif
 	return -EINVAL;
 }