X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=libbb%2Fparse_mode.c;h=5a4e1c579c3fdfa1c330b61f16fded15e98f05a5;hb=3e7ecb179b193bf17323c975890eed1d025f7e4c;hp=a31bd4bfd604cc950d50661fda58a79affed260e;hpb=99912ca733dd960f5589227fd999c86e73c8e894;p=oweals%2Fbusybox.git diff --git a/libbb/parse_mode.c b/libbb/parse_mode.c index a31bd4bfd..5a4e1c579 100644 --- a/libbb/parse_mode.c +++ b/libbb/parse_mode.c @@ -4,7 +4,7 @@ * * Copyright (C) 2003 Manuel Novoa III * - * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. + * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ /* http://www.opengroup.org/onlinepubs/007904975/utilities/chmod.html */ @@ -15,7 +15,7 @@ #define FILEMODEBITS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) -int bb_parse_mode(const char *s, mode_t *current_mode) +int FAST_FUNC bb_parse_mode(const char *s, mode_t *current_mode) { static const mode_t who_mask[] = { S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO, /* a */ @@ -31,8 +31,8 @@ int bb_parse_mode(const char *s, mode_t *current_mode) S_ISUID | S_ISGID, /* s */ S_ISVTX /* t */ }; - static const char who_chars[] = "augo"; - static const char perm_chars[] = "rwxXst"; + static const char who_chars[] ALIGN1 = "augo"; + static const char perm_chars[] ALIGN1 = "rwxXst"; const char *p; mode_t wholist; @@ -40,7 +40,7 @@ int bb_parse_mode(const char *s, mode_t *current_mode) mode_t new_mode; char op; - if (((unsigned int)(*s - '0')) < 8) { + if ((unsigned char)(*s - '0') < 8) { unsigned long tmp; char *e; @@ -57,8 +57,8 @@ int bb_parse_mode(const char *s, mode_t *current_mode) /* Note: we allow empty clauses, and hence empty modes. * We treat an empty mode as no change to perms. */ - while (*s) { /* Process clauses. */ - if (*s == ',') { /* We allow empty clauses. */ + while (*s) { /* Process clauses. */ + if (*s == ',') { /* We allow empty clauses. */ ++s; continue; } @@ -77,7 +77,7 @@ int bb_parse_mode(const char *s, mode_t *current_mode) } } while (*++p); - do { /* Process action list. */ + do { /* Process action list. */ if ((*s != '+') && (*s != '-')) { if (*s != '=') { return 0; @@ -93,7 +93,7 @@ int bb_parse_mode(const char *s, mode_t *current_mode) op = *s++; /* Check for permcopy. */ - p = who_chars + 1; /* Skip 'a' entry. */ + p = who_chars + 1; /* Skip 'a' entry. */ do { if (*p == *s) { int i = 0; @@ -128,7 +128,7 @@ int bb_parse_mode(const char *s, mode_t *current_mode) } } while (*++p); GOT_ACTION: - if (permlist) { /* The permlist was nonempty. */ + if (permlist) { /* The permlist was nonempty. */ mode_t tmp = wholist; if (!wholist) { mode_t u_mask = umask(0);