From a85653040477ec4e8a722de3af5afd04ee66bd59 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Mon, 7 Jan 2019 07:54:40 +0000 Subject: 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. --- shell/ash.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'shell') 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) if (!isdigit(modestr[0])) mask ^= 0777; umask(mask); +#if ENABLE_PLATFORM_MINGW32 + setvareq(xasprintf("BB_UMASK=0%o", mask), VEXPORT|VNOSAVE); +#endif } return 0; } -- cgit v1.2.3-55-g6feb