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-w32-35b54a3c247235b1bffe2a22784a1d5be10267f3.tar.gz
busybox-w32-35b54a3c247235b1bffe2a22784a1d5be10267f3.tar.bz2
busybox-w32-35b54a3c247235b1bffe2a22784a1d5be10267f3.zip
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 @@
12 12
13#include "libbb.h" 13#include "libbb.h"
14 14
15#ifdef HAVE_MNTENT_H 15int FAST_FUNC fstype_matches(const char *fstype, const char *comma_list)
16
17int FAST_FUNC match_fstype(const struct mntent *mt, const char *t_fstype)
18{ 16{
19 int match = 1; 17 int match = 1;
20 18
21 if (!t_fstype) 19 if (!comma_list)
22 return match; 20 return match;
23 21
24 if (t_fstype[0] == 'n' && t_fstype[1] == 'o') { 22 if (comma_list[0] == 'n' && comma_list[1] == 'o') {
25 match--; 23 match--;
26 t_fstype += 2; 24 comma_list += 2;
27 } 25 }
28 26
29 while (1) { 27 while (1) {
30 char *after_mnt_type = is_prefixed_with(t_fstype, mt->mnt_type); 28 char *after_mnt_type = is_prefixed_with(comma_list, fstype);
31 if (after_mnt_type 29 if (after_mnt_type
32 && (*after_mnt_type == '\0' || *after_mnt_type == ',') 30 && (*after_mnt_type == '\0' || *after_mnt_type == ',')
33 ) { 31 ) {
34 return match; 32 return match;
35 } 33 }
36 t_fstype = strchr(t_fstype, ','); 34 comma_list = strchr(comma_list, ',');
37 if (!t_fstype) 35 if (!comma_list)
38 break; 36 break;
39 t_fstype++; 37 comma_list++;
40 } 38 }
41 39
42 return !match; 40 return !match;
43} 41}
44
45#endif /* HAVE_MNTENT_H */