aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/gen
diff options
context:
space:
mode:
authorAlex Richardson <arichardson@FreeBSD.org>2020-08-03 18:08:04 +0000
committerAlex Richardson <arichardson@FreeBSD.org>2020-08-03 18:08:04 +0000
commit9053c1a4316e0168d52ec2de8a7669bf0fd5e2c1 (patch)
tree653d8f14ac7b343262521b9f988c04273771ffd4 /lib/libc/gen
parent338b22234b4f300b948ea8d1292bc023976516b8 (diff)
Notes
Diffstat (limited to 'lib/libc/gen')
-rw-r--r--lib/libc/gen/setmode.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libc/gen/setmode.c b/lib/libc/gen/setmode.c
index 05fe58952e9da..66976cdd7bcf0 100644
--- a/lib/libc/gen/setmode.c
+++ b/lib/libc/gen/setmode.c
@@ -70,7 +70,7 @@ typedef struct bitcmd {
#define CMD2_OBITS 0x08
#define CMD2_UBITS 0x10
-static mode_t getumask(void);
+static mode_t get_current_umask(void);
static BITCMD *addcmd(BITCMD *, mode_t, mode_t, mode_t, mode_t);
static void compress_mode(BITCMD *);
#ifdef SETMODE_DEBUG
@@ -186,7 +186,7 @@ setmode(const char *p)
* Get a copy of the mask for the permissions that are mask relative.
* Flip the bits, we want what's not set.
*/
- mask = ~getumask();
+ mask = ~get_current_umask();
setlen = SET_LEN + 2;
@@ -343,13 +343,14 @@ out:
}
static mode_t
-getumask(void)
+get_current_umask(void)
{
sigset_t sigset, sigoset;
size_t len;
mode_t mask;
u_short smask;
+#ifdef KERN_PROC_UMASK
/*
* First try requesting the umask without temporarily modifying it.
* Note that this does not work if the sysctl
@@ -359,7 +360,7 @@ getumask(void)
if (sysctl((int[4]){ CTL_KERN, KERN_PROC, KERN_PROC_UMASK, 0 },
4, &smask, &len, NULL, 0) == 0)
return (smask);
-
+#endif
/*
* Since it's possible that the caller is opening files inside a signal
* handler, protect them as best we can.