aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-01-30 00:45:05 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2017-01-30 00:45:05 +0100
commit35b54a3c247235b1bffe2a22784a1d5be10267f3 (patch)
tree4fa803d221cd4895fde17a611edc9ae2a32ddc35 /libbb
parenteba7fe6bb9fdc89cf9d4d33043cd3856253d303d (diff)
downloadbusybox-35b54a3c247235b1bffe2a22784a1d5be10267f3.tar.gz
libbb: match_fstype() is unreadable in the extreme, fixing it
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/match_fstype.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/libbb/match_fstype.c b/libbb/match_fstype.c
index b066b4211..6046bc6db 100644
--- a/libbb/match_fstype.c
+++ b/libbb/match_fstype.c
@@ -12,34 +12,30 @@
#include "libbb.h"
-#ifdef HAVE_MNTENT_H
-
-int FAST_FUNC match_fstype(const struct mntent *mt, const char *t_fstype)
+int FAST_FUNC fstype_matches(const char *fstype, const char *comma_list)
{
int match = 1;
- if (!t_fstype)
+ if (!comma_list)
return match;
- if (t_fstype[0] == 'n' && t_fstype[1] == 'o') {
+ if (comma_list[0] == 'n' && comma_list[1] == 'o') {
match--;
- t_fstype += 2;
+ comma_list += 2;
}
while (1) {
- char *after_mnt_type = is_prefixed_with(t_fstype, mt->mnt_type);
+ char *after_mnt_type = is_prefixed_with(comma_list, fstype);
if (after_mnt_type
&& (*after_mnt_type == '\0' || *after_mnt_type == ',')
) {
return match;
}
- t_fstype = strchr(t_fstype, ',');
- if (!t_fstype)
+ comma_list = strchr(comma_list, ',');
+ if (!comma_list)
break;
- t_fstype++;
+ comma_list++;
}
return !match;
}
-
-#endif /* HAVE_MNTENT_H */