aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-10-12 22:42:33 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-10-12 22:42:33 +0000
commit372686bde7b4c0abaf01123d8dda1dc6ab9a92e2 (patch)
treeb92d3fb32074fc429866c41759b38c83f6ba950a /util-linux
parent9c267b851e54441b867293973fd5a898b847df39 (diff)
downloadbusybox-372686bde7b4c0abaf01123d8dda1dc6ab9a92e2.tar.gz
cut, mount: small improvements
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/mount.c23
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)
static llist_t *get_block_backed_filesystems(void)
{
- char *fs, *buf,
- *filesystems[] = {"/etc/filesystems", "/proc/filesystems", 0};
+ static const char *const filesystems[] = {
+ "/etc/filesystems",
+ "/proc/filesystems",
+ 0
+ };
+ char *fs, *buf;
llist_t *list = 0;
int i;
FILE *f;
@@ -182,16 +186,15 @@ static llist_t *get_block_backed_filesystems(void)
f = fopen(filesystems[i], "r");
if (!f) continue;
- for (fs = buf = 0; (fs = buf = bb_get_chomped_line_from_file(f));
- free(buf))
- {
- if (!strncmp(buf,"nodev",5) && isspace(buf[5])) continue;
-
+ while ((buf = bb_get_chomped_line_from_file(f)) != 0) {
+ if (!strncmp(buf, "nodev", 5) && isspace(buf[5]))
+ continue;
+ fs = buf;
while (isspace(*fs)) fs++;
- if (*fs=='#' || *fs=='*') continue;
- if (!*fs) continue;
+ if (*fs=='#' || *fs=='*' || !*fs) continue;
- llist_add_to_end(&list,xstrdup(fs));
+ llist_add_to_end(&list, xstrdup(fs));
+ free(buf);
}
if (ENABLE_FEATURE_CLEAN_UP) fclose(f);
}