--- acl-2.2.51/setfacl/parse.c.orig 2010-01-22 23:00:28.000000000 +0000 +++ acl-2.2.51/setfacl/parse.c 2011-08-03 17:03:19.000000000 +0000 @@ -419,7 +419,13 @@ 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 @@ 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 @@ 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 @@ } } 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; }