Don't call perror() if no changes happens in errno
This commit is contained in:
parent
0db7552e00
commit
094de3037b
|
@ -342,14 +342,19 @@ main (int argc, char **argv)
|
||||||
int j;
|
int j;
|
||||||
FcChar8 *cache_file = NULL;
|
FcChar8 *cache_file = NULL;
|
||||||
struct stat file_stat;
|
struct stat file_stat;
|
||||||
|
|
||||||
|
/* reset errno */
|
||||||
|
errno = 0;
|
||||||
if (FcFileIsDir (arg))
|
if (FcFileIsDir (arg))
|
||||||
cache = FcDirCacheLoad (arg, config, &cache_file);
|
cache = FcDirCacheLoad (arg, config, &cache_file);
|
||||||
else
|
else
|
||||||
cache = FcDirCacheLoadFile (arg, &file_stat);
|
cache = FcDirCacheLoadFile (arg, &file_stat);
|
||||||
if (!cache)
|
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++;
|
ret++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue