diff options
-rw-r--r-- | shell/ash.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/shell/ash.c b/shell/ash.c index b09681296..8a1628e81 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -12826,27 +12826,25 @@ umaskcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
12826 | 12826 | ||
12827 | if (*argptr == NULL) { | 12827 | if (*argptr == NULL) { |
12828 | if (symbolic_mode) { | 12828 | if (symbolic_mode) { |
12829 | char buf[sizeof("u=rwx,g=rwx,o=rwx")]; | 12829 | char buf[sizeof(",u=rwx,g=rwx,o=rwx")]; |
12830 | char *p = buf; | 12830 | char *p = buf; |
12831 | int i; | 12831 | int i; |
12832 | 12832 | ||
12833 | i = 2; | 12833 | i = 2; |
12834 | for (;;) { | 12834 | for (;;) { |
12835 | unsigned bits; | 12835 | *p++ = ','; |
12836 | |||
12837 | *p++ = permuser[i]; | 12836 | *p++ = permuser[i]; |
12838 | *p++ = '='; | 12837 | *p++ = '='; |
12839 | /* mask is 0..0uuugggooo. i=2 selects uuu bits */ | 12838 | /* mask is 0..0uuugggooo. i=2 selects uuu bits */ |
12840 | bits = (mask >> (i*3)); | 12839 | if (!(mask & 0400)) *p++ = 'r'; |
12841 | if (!(bits & 4)) *p++ = 'r'; | 12840 | if (!(mask & 0200)) *p++ = 'w'; |
12842 | if (!(bits & 2)) *p++ = 'w'; | 12841 | if (!(mask & 0100)) *p++ = 'x'; |
12843 | if (!(bits & 1)) *p++ = 'x'; | 12842 | mask <<= 3; |
12844 | if (--i < 0) | 12843 | if (--i < 0) |
12845 | break; | 12844 | break; |
12846 | *p++ = ','; | ||
12847 | } | 12845 | } |
12848 | *p = '\0'; | 12846 | *p = '\0'; |
12849 | puts(buf); | 12847 | puts(buf + 1); |
12850 | } else { | 12848 | } else { |
12851 | out1fmt("%04o\n", mask); | 12849 | out1fmt("%04o\n", mask); |
12852 | } | 12850 | } |