Stop calling chmod() in cache update code.

These calls are useless to toxic and come in the way of adding pledge
to applications (would require 'fattr' which is quite wide).
Discussed with deraadt, millert and jcs.
Submitted upstreams too.
This commit is contained in:
matthieu 2019-10-28 19:38:47 +00:00
parent 1e2269ecbb
commit 96afcbe794
2 changed files with 2 additions and 12 deletions

View File

@ -1030,16 +1030,6 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config)
break;
}
}
/*
* Otherwise, try making it writable
*/
else if (chmod ((char *) d, 0755) == 0)
{
cache_dir = FcStrCopyFilename (d);
/* Try to create CACHEDIR.TAG too */
FcDirCacheCreateTagFile (d);
break;
}
}
}
if (d)

View File

@ -249,9 +249,9 @@ FcMakeDirectory (const FcChar8 *dir)
if (!parent)
return FcFalse;
if (access ((char *) parent, F_OK) == 0)
ret = mkdir ((char *) dir, 0755) == 0 && chmod ((char *) dir, 0755) == 0;
ret = mkdir ((char *) dir, 0755) == 0;
else if (access ((char *) parent, F_OK) == -1)
ret = FcMakeDirectory (parent) && (mkdir ((char *) dir, 0755) == 0) && chmod ((char *) dir, 0755) == 0;
ret = FcMakeDirectory (parent) && (mkdir ((char *) dir, 0755) == 0);
else
ret = FcFalse;
FcStrFree (parent);