diff options
author | Ingo Bürk <admin@airblader.de> | 2017-03-16 14:27:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-16 14:27:21 +0100 |
commit | 3ae0decbb33015fb111cdf7ea3d117bd6988cc05 (patch) | |
tree | ccbed1dab7f4d9a2cd47700d1c0f1e85d71a2c1a | |
parent | 09c758eed5c1d541f33c72351eef39517fad0126 (diff) | |
parent | 8e12ad8308742f0fd905c48d26c149b59349b6ee (diff) |
Merge pull request #211 from ixjlyons/issue210
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; |