summaryrefslogtreecommitdiff
path: root/src/fontfile/dirfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fontfile/dirfile.c')
-rw-r--r--src/fontfile/dirfile.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/fontfile/dirfile.c b/src/fontfile/dirfile.c
index 5f90501..bb7c339 100644
--- a/src/fontfile/dirfile.c
+++ b/src/fontfile/dirfile.c
@@ -25,7 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
-/* $XFree86: xc/lib/font/fontfile/dirfile.c,v 3.15 2002/05/31 18:45:50 dawes Exp $ */
+/* $XFree86: xc/lib/font/fontfile/dirfile.c,v 3.16 2003/04/07 16:23:31 eich Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
@@ -90,6 +90,8 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir)
strcat(dir_file, FontDirFile);
file = fopen(dir_file, "r");
if (file) {
+ Bool found_font = FALSE;
+
if (fstat (fileno(file), &statb) == -1)
return BadFontPath;
count = fscanf(file, "%d\n", &i);
@@ -106,6 +108,7 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir)
if (format[0] == '\0')
sprintf(format, "%%%ds %%%d[^\n]\n",
MAXFONTFILENAMELEN-1, MAXFONTNAMELEN-1);
+
while ((count = fscanf(file, format, file_name, font_name)) != EOF) {
#ifdef __UNIXOS2__
/* strip any existing trailing CR */
@@ -118,14 +121,16 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir)
fclose(file);
return BadFontPath;
}
- if (!FontFileAddFontFile (dir, font_name, file_name))
- {
- FontFileFreeDir (dir);
- fclose(file);
- return BadFontPath;
- }
+ if (FontFileAddFontFile (dir, font_name, file_name))
+ found_font = TRUE;
+ }
+ if (!found_font) {
+ FontFileFreeDir (dir);
+ fclose(file);
+ return BadFontPath;
}
fclose(file);
+
} else if (errno != ENOENT) {
return BadFontPath;
}