diff options
author | Ron Yorston <rmy@pobox.com> | 2019-01-07 07:54:40 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2019-01-07 07:54:40 +0000 |
commit | a85653040477ec4e8a722de3af5afd04ee66bd59 (patch) | |
tree | 22c36324fd4cf68764f0df846321bc5a12a611fb /shell | |
parent | 1fec4ebbdb930f6b8989be2e10c0f673803ac830 (diff) | |
download | busybox-w32-a85653040477ec4e8a722de3af5afd04ee66bd59.tar.gz busybox-w32-a85653040477ec4e8a722de3af5afd04ee66bd59.tar.bz2 busybox-w32-a85653040477ec4e8a722de3af5afd04ee66bd59.zip |
win32: implement umask(2)
umask() in the Microsoft C runtime takes different arguments to
umask(2). Implement a fake umask(2) that remembers the mask and
calls the Microsoft umask() with an appropriate value.
Since the mask won't be inherited by children use an environment
variable to pass any value set by the shell built-in umask.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c index 5195a8557..d9a4a8cfa 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -14489,6 +14489,9 @@ umaskcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
14489 | if (!isdigit(modestr[0])) | 14489 | if (!isdigit(modestr[0])) |
14490 | mask ^= 0777; | 14490 | mask ^= 0777; |
14491 | umask(mask); | 14491 | umask(mask); |
14492 | #if ENABLE_PLATFORM_MINGW32 | ||
14493 | setvareq(xasprintf("BB_UMASK=0%o", mask), VEXPORT|VNOSAVE); | ||
14494 | #endif | ||
14492 | } | 14495 | } |
14493 | return 0; | 14496 | return 0; |
14494 | } | 14497 | } |