diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/common.c b/src/common.c index 2a4da006..d8ee9915 100644 --- a/src/common.c +++ b/src/common.c @@ -443,7 +443,11 @@ int is_regular_file(const char *path) { struct stat st; - stat(path, &st); + int ret = stat(path, &st); + if (ret != 0) { + perror(NULL); + return 0; + } return S_ISREG(st.st_mode); } @@ -451,7 +455,11 @@ int is_dir(const char *path) { struct stat st; - stat(path, &st); + int ret = stat(path, &st); + if (ret != 0) { + perror(NULL); + return 0; + } return S_ISDIR(st.st_mode); } |