diff options
Diffstat (limited to 'util-linux/lsblk.c')
| -rw-r--r-- | util-linux/lsblk.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/util-linux/lsblk.c b/util-linux/lsblk.c index a482bfbbc..3bd40bcb4 100644 --- a/util-linux/lsblk.c +++ b/util-linux/lsblk.c | |||
| @@ -101,10 +101,10 @@ static char *get_mountpoints(const char *majmin) | |||
| 101 | 101 | ||
| 102 | mountpoints = NULL; | 102 | mountpoints = NULL; |
| 103 | len = strlen(majmin); | 103 | len = strlen(majmin); |
| 104 | p = G.mountinfo; // "/proc/self/mountinfo" | 104 | p = G.mountinfo; // contents of "/proc/self/mountinfo" |
| 105 | /* lines a-la "63 1 259:3 / /MNTPOINT per-mount_options - ext4 /dev/NAME per-superblock_options" */ | 105 | /* lines a-la "63 1 259:3 / /MNTPOINT per-mount_options - ext4 /dev/NAME per-superblock_options" */ |
| 106 | while (*p) { | 106 | while (*p) { |
| 107 | char *e, *f; | 107 | char *e; |
| 108 | 108 | ||
| 109 | p = skip_non_whitespace(p); | 109 | p = skip_non_whitespace(p); |
| 110 | if (*p != ' ') break; | 110 | if (*p != ' ') break; |
| @@ -127,12 +127,11 @@ static char *get_mountpoints(const char *majmin) | |||
| 127 | // at " /MNTPOINT" | 127 | // at " /MNTPOINT" |
| 128 | e = skip_non_whitespace(p + 1); | 128 | e = skip_non_whitespace(p + 1); |
| 129 | // e is at the end of " /MNTPOINT" | 129 | // e is at the end of " /MNTPOINT" |
| 130 | f = mountpoints; | ||
| 131 | // NO. We return " /MNT1 /MNT2 /MNT3" _with_ leading space! | 130 | // NO. We return " /MNT1 /MNT2 /MNT3" _with_ leading space! |
| 132 | // if (!f) | 131 | // if (!mountpoints) |
| 133 | // p++; | 132 | // p++; |
| 134 | mountpoints = xasprintf("%s%.*s", f ? f : "", (int)(e - p), p); | 133 | xasprintf_inplace(mountpoints, "%s%.*s", |
| 135 | free(f); | 134 | mountpoints ? mountpoints : "", (int)(e - p), p); |
| 136 | } | 135 | } |
| 137 | return mountpoints; | 136 | return mountpoints; |
| 138 | } | 137 | } |
