]> git.sur5r.net Git - i3/i3status/commitdiff
disk: don't remove trailing slash if path is a single character 211/head
authorKenneth Lyons <ixjlyons@gmail.com>
Fri, 10 Mar 2017 19:24:56 +0000 (11:24 -0800)
committerKenneth Lyons <ixjlyons@gmail.com>
Fri, 10 Mar 2017 19:24:56 +0000 (11:24 -0800)
src/print_disk_info.c

index 3be81eaa604d409a75233bcf7963f97bd9f4b511..fb7348019b33f1de40a83f7a576d7c8c8193f4fb 100644 (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;