From: Kenneth Lyons Date: Fri, 10 Mar 2017 19:24:56 +0000 (-0800) Subject: disk: don't remove trailing slash if path is a single character X-Git-Tag: 2.12~23^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8e12ad8308742f0fd905c48d26c149b59349b6ee;p=i3%2Fi3status disk: don't remove trailing slash if path is a single character --- 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;