mkdir() is supposed to respect the umask when creating the directory.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23438 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2007, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2002-2008, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -9,6 +9,10 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
|
extern mode_t __gUmask;
|
||||||
|
// declared in sys/umask.c
|
||||||
|
|
||||||
|
|
||||||
#define RETURN_AND_SET_ERRNO(err) \
|
#define RETURN_AND_SET_ERRNO(err) \
|
||||||
if (err < 0) { \
|
if (err < 0) { \
|
||||||
errno = err; \
|
errno = err; \
|
||||||
@@ -20,7 +24,7 @@
|
|||||||
int
|
int
|
||||||
mkdir(const char* path, mode_t mode)
|
mkdir(const char* path, mode_t mode)
|
||||||
{
|
{
|
||||||
status_t status = _kern_create_dir(-1, path, mode);
|
status_t status = _kern_create_dir(-1, path, mode & ~__gUmask);
|
||||||
|
|
||||||
RETURN_AND_SET_ERRNO(status);
|
RETURN_AND_SET_ERRNO(status);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user