diff options
Diffstat (limited to 'wrapper.c')
-rw-r--r-- | wrapper.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -690,3 +690,16 @@ int xgethostname(char *buf, size_t len) buf[len - 1] = 0; return ret; } + +int is_empty_or_missing_file(const char *filename) +{ + struct stat st; + + if (stat(filename, &st) < 0) { + if (errno == ENOENT) + return 1; + die_errno(_("could not stat %s"), filename); + } + + return !st.st_size; +} |