diff options
Diffstat (limited to 'libmount/src/utils.c')
-rw-r--r-- | libmount/src/utils.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libmount/src/utils.c b/libmount/src/utils.c index 1c37062e6..1d4fd0e4b 100644 --- a/libmount/src/utils.c +++ b/libmount/src/utils.c @@ -54,6 +54,17 @@ int startswith(const char *s, const char *sx) return !strncmp(s, sx, off); } +/* + * Return 1 if the file does not accessible of empty + */ +int is_file_empty(const char *name) +{ + struct stat st; + assert(name); + + return (stat(name, &st) != 0 || st.st_size == 0); +} + int mnt_parse_offset(const char *str, size_t len, uintmax_t *res) { char *p; |