diff options
author | Kenneth Lyons <ixjlyons@gmail.com> | 2017-03-10 11:24:56 -0800 |
---|---|---|
committer | Kenneth Lyons <ixjlyons@gmail.com> | 2017-03-10 11:24:56 -0800 |
commit | 8e12ad8308742f0fd905c48d26c149b59349b6ee (patch) | |
tree | ccbed1dab7f4d9a2cd47700d1c0f1e85d71a2c1a | |
parent | 09c758eed5c1d541f33c72351eef39517fad0126 (diff) |
disk: don't remove trailing slash if path is a single character
-rw-r--r-- | src/print_disk_info.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/print_disk_info.c b/src/print_disk_info.c index 3be81ea..fb73480 100644 --- a/src/print_disk_info.c +++ b/src/print_disk_info.c @@ -142,7 +142,7 @@ void print_disk_info(yajl_gen json_gen, char *buffer, const char *path, const ch mounted = false; } else { char *sanitized = sstrdup(path); - if (sanitized[strlen(sanitized) - 1] == '/') + if (strlen(sanitized) > 1 && sanitized[strlen(sanitized) - 1] == '/') sanitized[strlen(sanitized) - 1] = '\0'; FILE *mntentfile = setmntent("/etc/mtab", "r"); struct mntent *m; |