From abdb6d658e1a16410dd1c964e365a3ebd5039e7c Mon Sep 17 00:00:00 2001 From: Akira TAGOH Date: Wed, 1 Mar 2017 19:48:02 +0900 Subject: Fix the build issue on GNU/Hurd PATH_MAX isn't defined on GNU/Hurd. according to the porting guidelines (https://www.gnu.org/software/hurd/hurd/porting/guidelines.html) allocate a memory dynamically instead of relying on the length of a string with PATH_MAX. https://bugs.freedesktop.org/show_bug.cgi?id=97512 --- src/fcstat.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/fcstat.c') diff --git a/src/fcstat.c b/src/fcstat.c index 1734fa4..f6e1aaa 100644 --- a/src/fcstat.c +++ b/src/fcstat.c @@ -278,8 +278,13 @@ FcDirChecksum (const FcChar8 *dir, time_t *checksum) { #endif struct stat statb; - char f[PATH_MAX + 1]; + char *f = malloc (len + 1 + dlen + 1); + if (!f) + { + ret = -1; + goto bail; + } memcpy (f, dir, len); f[len] = FC_DIR_SEPARATOR; memcpy (&f[len + 1], files[n]->d_name, dlen); @@ -287,11 +292,16 @@ FcDirChecksum (const FcChar8 *dir, time_t *checksum) if (lstat (f, &statb) < 0) { ret = -1; + free (f); goto bail; } if (S_ISDIR (statb.st_mode)) + { + free (f); goto bail; + } + free (f); dtype = statb.st_mode; #ifdef HAVE_STRUCT_DIRENT_D_TYPE } -- cgit v1.2.1