diff options
-rw-r--r-- | include/libbb.h | 2 | ||||
-rw-r--r-- | libbb/parse_mode.c | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/include/libbb.h b/include/libbb.h index 1ec8d2d3b..6727c22b2 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -1607,7 +1607,7 @@ char *bb_ask_noecho_stdin(const char *prompt) FAST_FUNC; | |||
1607 | int bb_ask_y_confirmation_FILE(FILE *fp) FAST_FUNC; | 1607 | int bb_ask_y_confirmation_FILE(FILE *fp) FAST_FUNC; |
1608 | int bb_ask_y_confirmation(void) FAST_FUNC; | 1608 | int bb_ask_y_confirmation(void) FAST_FUNC; |
1609 | 1609 | ||
1610 | /* Returns -1 if input is invalid. current_mode is a base for e.g. "u+rw" */ | 1610 | /* Returns -1 if input is invalid. cur_mode is a base for e.g. "u+rw" */ |
1611 | int bb_parse_mode(const char* s, unsigned cur_mode) FAST_FUNC; | 1611 | int bb_parse_mode(const char* s, unsigned cur_mode) FAST_FUNC; |
1612 | 1612 | ||
1613 | /* | 1613 | /* |
diff --git a/libbb/parse_mode.c b/libbb/parse_mode.c index dc65860f6..1d238e1e0 100644 --- a/libbb/parse_mode.c +++ b/libbb/parse_mode.c | |||
@@ -16,13 +16,14 @@ | |||
16 | 16 | ||
17 | int FAST_FUNC bb_parse_mode(const char *s, unsigned current_mode) | 17 | int FAST_FUNC bb_parse_mode(const char *s, unsigned current_mode) |
18 | { | 18 | { |
19 | static const mode_t who_mask[] = { | 19 | /* should be mode_t really, but in all Unixes these constants fit into uint16 */ |
20 | static const uint16_t who_mask[] ALIGN2 = { | ||
20 | S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO, /* a */ | 21 | S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO, /* a */ |
21 | S_ISUID | S_IRWXU, /* u */ | 22 | S_ISUID | S_IRWXU, /* u */ |
22 | S_ISGID | S_IRWXG, /* g */ | 23 | S_ISGID | S_IRWXG, /* g */ |
23 | S_IRWXO /* o */ | 24 | S_IRWXO /* o */ |
24 | }; | 25 | }; |
25 | static const mode_t perm_mask[] = { | 26 | static const uint16_t perm_mask[] ALIGN2 = { |
26 | S_IRUSR | S_IRGRP | S_IROTH, /* r */ | 27 | S_IRUSR | S_IRGRP | S_IROTH, /* r */ |
27 | S_IWUSR | S_IWGRP | S_IWOTH, /* w */ | 28 | S_IWUSR | S_IWGRP | S_IWOTH, /* w */ |
28 | S_IXUSR | S_IXGRP | S_IXOTH, /* x */ | 29 | S_IXUSR | S_IXGRP | S_IXOTH, /* x */ |