diff options
| author | Michael Stapelberg | 2015-05-29 09:52:46 +0200 | 
|---|---|---|
| committer | Michael Stapelberg | 2015-05-29 09:52:46 +0200 | 
| commit | adaa83222ce441e3efa1476127e8ef5171c626da (patch) | |
| tree | 3a13223bb57c97ae0b429143508ba2910146d717 /src | |
| parent | Clamp the percentage at 100% when last_full_capacity is enabled. (diff) | |
| parent | Use format_not_mounted if the directory for a disk_info block does not exist. (diff) | |
Merge pull request #35 from Airblader/feature-33
Use format_not_mounted if path does not exist
Diffstat (limited to 'src')
| -rw-r--r-- | src/print_disk_info.c | 9 | 
1 files changed, 5 insertions, 4 deletions
| diff --git a/src/print_disk_info.c b/src/print_disk_info.c index 69d7b8c..7fd47b9 100644 --- a/src/print_disk_info.c +++ b/src/print_disk_info.c @@ -124,10 +124,11 @@ void print_disk_info(yajl_gen json_gen, char *buffer, const char *path, const ch  #else      struct statvfs buf; -    if (statvfs(path, &buf) == -1) -        return; - -    if (format_not_mounted != NULL) { +    if (statvfs(path, &buf) == -1) { +        /* If statvfs errors, e.g., due to the path not existing, +         * we use the format for a not mounted device. */ +        format = format_not_mounted; +    } else if (format_not_mounted != NULL) {          FILE *mntentfile = setmntent("/etc/mtab", "r");          struct mntent *m;          bool found = false; | 
