[Fontconfig] fontconfig: Branch 'master'

Akira TAGOH tagoh at kemper.freedesktop.org
Wed Sep 7 02:40:39 UTC 2016


 fc-cat/fc-cat.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 094de3037b9e6e040fa0566593620525e534a7cd
Author: Akira TAGOH <akira at tagoh.org>
Date:   Wed Sep 7 11:39:11 2016 +0900

    Don't call perror() if no changes happens in errno

diff --git a/fc-cat/fc-cat.c b/fc-cat/fc-cat.c
index f0131b6..a1dc848 100644
--- a/fc-cat/fc-cat.c
+++ b/fc-cat/fc-cat.c
@@ -342,14 +342,19 @@ main (int argc, char **argv)
 	int	    j;
 	FcChar8	    *cache_file = NULL;
 	struct stat file_stat;
-	
+
+	/* reset errno */
+	errno = 0;
 	if (FcFileIsDir (arg))
 	    cache = FcDirCacheLoad (arg, config, &cache_file);
 	else
 	    cache = FcDirCacheLoadFile (arg, &file_stat);
 	if (!cache)
 	{
-	    perror ((char *) arg);
+	    if (errno != 0)
+		perror ((char *) arg);
+	    else
+		fprintf (stderr, "%s: Unable to load the cache: %s\n", argv[0], arg);
 	    ret++;
 	    continue;
 	}


More information about the Fontconfig mailing list