diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2019-01-08 16:39:54 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2019-01-08 16:39:54 +0000 |
commit | f5322e41ae8fa0124bb5adcb3ef12db6ebeabeab (patch) | |
tree | d0cc8aabd570c818b2dbd82889feaf7adb2a74c9 /src/libposixplz | |
parent | 08d02a8c3176ba0b04dd10bd97e06a7caffe5491 (diff) | |
download | skalibs-f5322e41ae8fa0124bb5adcb3ef12db6ebeabeab.tar.xz |
Proper use of umask for mk[bcp]temp
Diffstat (limited to 'src/libposixplz')
-rw-r--r-- | src/libposixplz/mkbtemp.c | 2 | ||||
-rw-r--r-- | src/libposixplz/mkctemp.c | 2 | ||||
-rw-r--r-- | src/libposixplz/mkptemp.c | 2 |
3 files changed, 6 insertions, 0 deletions
diff --git a/src/libposixplz/mkbtemp.c b/src/libposixplz/mkbtemp.c index c4c62df..e2b4a93 100644 --- a/src/libposixplz/mkbtemp.c +++ b/src/libposixplz/mkbtemp.c @@ -8,7 +8,9 @@ static int f (char const *fn, mode_t mode, void *data) { dev_t *devp = data ; + mode_t m = umask(0) ; int r = mknod(fn, (mode & 00777) | S_IFBLK, *devp) ; + umask(m) ; if (r == -1) return -1 ; r = open_readb(fn) ; if (r == -1) unlink_void(fn) ; diff --git a/src/libposixplz/mkctemp.c b/src/libposixplz/mkctemp.c index 69035fb..6cf278c 100644 --- a/src/libposixplz/mkctemp.c +++ b/src/libposixplz/mkctemp.c @@ -8,7 +8,9 @@ static int f (char const *fn, mode_t mode, void *data) { dev_t *devp = data ; + mode_t m = umask(0) ; int r = mknod(fn, (mode & 00777) | S_IFCHR, *devp) ; + umask(m) ; if (r == -1) return -1 ; r = open_readb(fn) ; if (r == -1) unlink_void(fn) ; diff --git a/src/libposixplz/mkptemp.c b/src/libposixplz/mkptemp.c index 42bc715..64ddb5c 100644 --- a/src/libposixplz/mkptemp.c +++ b/src/libposixplz/mkptemp.c @@ -7,7 +7,9 @@ static int f (char const *fn, mode_t mode, void *data) { + mode_t m = umask(0) ; int r = mkfifo(fn, mode) ; + umask(m) ; if (r == -1) return -1 ; r = open_readb(fn) ; if (r == -1) unlink_void(fn) ; |