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
|
Description: fix for platforms that don't define PATH_MAX
Author: Sébastien Noel <sebastien@twolife.be>
Forwarded: TODO
--- a/source/plutovg-font.c
+++ b/source/plutovg-font.c
@@ -1006,8 +1006,10 @@
while((entry = readdir(dir)) != NULL) {
if(strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0)
continue;
- char path[PATH_MAX];
- snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name);
+ char *path;
+ size_t len = strlen(dirname) + 1 + strlen(entry->d_name) + 1;
+ path = malloc(len);
+ snprintf(path, len, "%s/%s", dirname, entry->d_name);
struct stat st;
if(stat(path, &st) == -1)
@@ -1017,6 +1019,7 @@
} else if(S_ISREG(st.st_mode) && plutovg_font_face_supports_file(path)) {
num_faces += plutovg_font_face_cache_load_file(cache, path);
}
+ free(path);
}
closedir(dir);
|