traceroute: fix help text to not show -6 when traceroute6 is off
[oweals/busybox.git] / libbb / parse_mode.c
index 3ab4eb6fcd9f9a6c6c4db789c2849b635bbfb92c..6eca00ab11e4eb9df3483984e754d929491191c5 100644 (file)
 
 #include "libbb.h"
 
+/* This function is used from NOFORK applets. It must not allocate anything */
+
 #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 */
@@ -29,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;
@@ -38,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;