diff options
author | Akira TAGOH <akira@tagoh.org> | 2016-09-07 11:39:11 +0900 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2016-09-07 11:39:11 +0900 |
commit | 094de3037b9e6e040fa0566593620525e534a7cd (patch) | |
tree | 4c043e8855b1bb36f3d0a0cbde95279b54d0457a /fc-cat | |
parent | 0db7552e001f3589c6372f33e09d511bc565c499 (diff) |
Don't call perror() if no changes happens in errno
Diffstat (limited to 'fc-cat')
-rw-r--r-- | fc-cat/fc-cat.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/fc-cat/fc-cat.c b/fc-cat/fc-cat.c index f0131b6d..a1dc848b 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; } |