disk: don't remove trailing slash if path is a single character

This commit is contained in:
Kenneth Lyons 2017-03-10 11:24:56 -08:00
parent 09c758eed5
commit 8e12ad8308

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;