summaryrefslogtreecommitdiff
path: root/mkfontscale.c
diff options
context:
space:
mode:
authorBernhard M. Wiedemann <bwiedemann@suse.de>2018-09-10 10:17:52 +0200
committerBernhard M. Wiedemann <bwiedemann@suse.de>2018-09-10 13:21:29 +0200
commit7b4203577af4b835ef069e0cd2bd9510b599789c (patch)
treea47248e21986ba32a7c98bddfbd9f71d41fe7e2e /mkfontscale.c
parent4b1d7d3af1c1bc1586b2e9a780aea0dee7df5a14 (diff)
Sort input file list
so that openSUSE's installation-images builds in a reproducible way in spite of indeterministic filesystem readdir order See https://reproducible-builds.org/ for why this is good. Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
Diffstat (limited to 'mkfontscale.c')
-rw-r--r--mkfontscale.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/mkfontscale.c b/mkfontscale.c
index e9b9488..eca8a1b 100644
--- a/mkfontscale.c
+++ b/mkfontscale.c
@@ -778,14 +778,13 @@ doDirectory(const char *dirname_given, int numEncodings, ListPtr encodingsToDo)
{
char *dirname, *fontscale_name, *filename, *encdir;
FILE *fontscale, *encfile;
- DIR *dirp;
- struct dirent *entry;
+ struct dirent** namelist;
FT_Error ftrc;
FT_Face face;
ListPtr encoding, xlfd, lp;
HashTablePtr entries;
HashBucketPtr *array;
- int i, n, found, rc;
+ int i, n, dirn, diri, found, rc;
int isBitmap=0,xl=0;
if (exclusionSuffix)
@@ -825,10 +824,10 @@ doDirectory(const char *dirname_given, int numEncodings, ListPtr encodingsToDo)
}
}
- dirp = opendir(dirname);
- if(dirp == NULL) {
+ dirn = scandir(dirname, &namelist, NULL, alphasort);
+ if(dirn < 0) {
fprintf(stderr, "%s: ", dirname);
- perror("opendir");
+ perror("scandir");
return 0;
}
@@ -843,7 +842,8 @@ doDirectory(const char *dirname_given, int numEncodings, ListPtr encodingsToDo)
return 0;
}
- while((entry = readdir(dirp)) != NULL) {
+ for(diri = dirn - 1; diri >= 0; diri--) {
+ struct dirent *entry = namelist[diri];
int have_face = 0;
char *xlfd_name = NULL;
struct stat f_stat;
@@ -991,7 +991,9 @@ doDirectory(const char *dirname_given, int numEncodings, ListPtr encodingsToDo)
#undef PRIO
}
- closedir(dirp);
+ while(dirn--)
+ free(namelist[dirn]);
+ free(namelist);
n = hashElements(entries);
fprintf(fontscale, "%d\n", n);
array = hashArray(entries, 1);