diff options
author | Michael Stapelberg <michael@stapelberg.de> | 2016-01-12 09:49:59 +0100 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2016-01-12 09:50:44 +0100 |
commit | fad9c8237c63290aa9adde5ba6ffa6759f578645 (patch) | |
tree | e4ce38acceb399f5e8a56818e39a637e321d653c /src/print_disk_info.c | |
parent | 617953117796d8ae0cff11a4192a923bdce34452 (diff) |
Bugfix: check that format_not_mounted is not NULL before using it
This issue was introduced with commit 75a83574.
fixes #92
Diffstat (limited to 'src/print_disk_info.c')
-rw-r--r-- | src/print_disk_info.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/print_disk_info.c b/src/print_disk_info.c index 12d7585..629e05b 100644 --- a/src/print_disk_info.c +++ b/src/print_disk_info.c @@ -127,7 +127,9 @@ void print_disk_info(yajl_gen json_gen, char *buffer, const char *path, const ch 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; + if (format_not_mounted != NULL) { + format = format_not_mounted; + } } else if (format_not_mounted != NULL) { FILE *mntentfile = setmntent("/etc/mtab", "r"); struct mntent *m; |