Commit | Line | Data |
---|---|---|
561840b4 MR |
1 | http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=636512 |
2 | ||
3 | From: Svante Signell <srs@kth.se> | |
4 | Subject: acl: Fix FTBFS on hurd-i386 | |
5 | Date: Wed, 03 Aug 2011 19:36:27 +0200 | |
6 | ||
7 | Currently acl does not compile on hurd-i386. The problem is a PATH_MAX | |
8 | definition which is not supported on GNU/Hurd. | |
9 | ||
10 | Index: acl-2.2.52/setfacl/parse.c | |
11 | =================================================================== | |
12 | --- acl-2.2.52/setfacl/parse.c | |
13 | +++ acl-2.2.52/setfacl/parse.c | |
14 | @@ -419,7 +419,13 @@ read_acl_comments( | |
15 | bytes for "# file: ". Not a good solution but for now it is the | |
16 | best I can do without too much impact on the code. [tw] | |
17 | */ | |
18 | + | |
19 | +#ifdef __GNU__ | |
20 | + char *linebuf; | |
21 | + size_t dummy = 0; | |
22 | +#else | |
23 | char linebuf[(4*PATH_MAX)+9]; | |
24 | +#endif | |
25 | char *cp; | |
26 | char *p; | |
27 | int comments_read = 0; | |
28 | @@ -449,9 +455,13 @@ read_acl_comments( | |
29 | if (line) | |
30 | (*line)++; | |
31 | ||
32 | +#ifdef __GNU__ | |
33 | + if (getline(&linebuf, &dummy, file) == -1) | |
34 | + break; | |
35 | +#else | |
36 | if (fgets(linebuf, sizeof(linebuf), file) == NULL) | |
37 | break; | |
38 | - | |
39 | +#endif | |
40 | comments_read = 1; | |
41 | ||
42 | p = strrchr(linebuf, '\0'); | |
43 | @@ -473,7 +483,12 @@ read_acl_comments( | |
44 | goto fail; | |
45 | *path_p = (char*)malloc(strlen(cp)+1); | |
46 | if (!*path_p) | |
47 | + { | |
48 | +#ifdef __GNU__ | |
49 | + free (linebuf); | |
50 | +#endif | |
51 | return -1; | |
52 | + } | |
53 | strcpy(*path_p, cp); | |
54 | } | |
55 | } else if (strncmp(cp, "owner:", 6) == 0) { | |
56 | @@ -522,13 +537,24 @@ read_acl_comments( | |
57 | } | |
58 | } | |
59 | if (ferror(file)) | |
60 | + { | |
61 | +#ifdef __GNU__ | |
62 | + free (linebuf); | |
63 | +#endif | |
64 | return -1; | |
65 | + } | |
66 | +#ifdef __GNU__ | |
67 | + free (linebuf); | |
68 | +#endif | |
69 | return comments_read; | |
70 | fail: | |
71 | if (path_p && *path_p) { | |
72 | free(*path_p); | |
73 | *path_p = NULL; | |
74 | } | |
75 | +#ifdef __GNU__ | |
76 | + free (linebuf); | |
77 | +#endif | |
78 | return -EINVAL; | |
79 | } | |
80 |