diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-12 22:42:33 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-12 22:42:33 +0000 |
commit | 372686bde7b4c0abaf01123d8dda1dc6ab9a92e2 (patch) | |
tree | b92d3fb32074fc429866c41759b38c83f6ba950a /util-linux | |
parent | 9c267b851e54441b867293973fd5a898b847df39 (diff) | |
download | busybox-w32-372686bde7b4c0abaf01123d8dda1dc6ab9a92e2.tar.gz busybox-w32-372686bde7b4c0abaf01123d8dda1dc6ab9a92e2.tar.bz2 busybox-w32-372686bde7b4c0abaf01123d8dda1dc6ab9a92e2.zip |
cut, mount: small improvements
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/mount.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c index 531fb4520..5448f1f21 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -172,8 +172,12 @@ static int parse_mount_options(char *options, char **unrecognized) | |||
172 | 172 | ||
173 | static llist_t *get_block_backed_filesystems(void) | 173 | static llist_t *get_block_backed_filesystems(void) |
174 | { | 174 | { |
175 | char *fs, *buf, | 175 | static const char *const filesystems[] = { |
176 | *filesystems[] = {"/etc/filesystems", "/proc/filesystems", 0}; | 176 | "/etc/filesystems", |
177 | "/proc/filesystems", | ||
178 | 0 | ||
179 | }; | ||
180 | char *fs, *buf; | ||
177 | llist_t *list = 0; | 181 | llist_t *list = 0; |
178 | int i; | 182 | int i; |
179 | FILE *f; | 183 | FILE *f; |
@@ -182,16 +186,15 @@ static llist_t *get_block_backed_filesystems(void) | |||
182 | f = fopen(filesystems[i], "r"); | 186 | f = fopen(filesystems[i], "r"); |
183 | if (!f) continue; | 187 | if (!f) continue; |
184 | 188 | ||
185 | for (fs = buf = 0; (fs = buf = bb_get_chomped_line_from_file(f)); | 189 | while ((buf = bb_get_chomped_line_from_file(f)) != 0) { |
186 | free(buf)) | 190 | if (!strncmp(buf, "nodev", 5) && isspace(buf[5])) |
187 | { | 191 | continue; |
188 | if (!strncmp(buf,"nodev",5) && isspace(buf[5])) continue; | 192 | fs = buf; |
189 | |||
190 | while (isspace(*fs)) fs++; | 193 | while (isspace(*fs)) fs++; |
191 | if (*fs=='#' || *fs=='*') continue; | 194 | if (*fs=='#' || *fs=='*' || !*fs) continue; |
192 | if (!*fs) continue; | ||
193 | 195 | ||
194 | llist_add_to_end(&list,xstrdup(fs)); | 196 | llist_add_to_end(&list, xstrdup(fs)); |
197 | free(buf); | ||
195 | } | 198 | } |
196 | if (ENABLE_FEATURE_CLEAN_UP) fclose(f); | 199 | if (ENABLE_FEATURE_CLEAN_UP) fclose(f); |
197 | } | 200 | } |