Merge pull request #211 from ixjlyons/issue210

disk: don't remove trailing slash if path is a single character
This commit is contained in:
Ingo Bürk 2017-03-16 14:27:21 +01:00 committed by GitHub
commit 3ae0decbb3
1 changed files with 1 additions and 1 deletions

View File

@ -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;