aboutsummaryrefslogtreecommitdiff
path: root/libbb/make_directory.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-10-13 06:25:52 +0000
committerEric Andersen <andersen@codepoet.org>2004-10-13 06:25:52 +0000
commit0e020d10257a7f1e4cd526eb6c49ba67a442ba85 (patch)
tree0f595c0a178264458bdeadab565bb5892f006d97 /libbb/make_directory.c
parent9315842242f18e3c5cf706b2bb349757928b2b40 (diff)
downloadbusybox-w32-0e020d10257a7f1e4cd526eb6c49ba67a442ba85.tar.gz
busybox-w32-0e020d10257a7f1e4cd526eb6c49ba67a442ba85.tar.bz2
busybox-w32-0e020d10257a7f1e4cd526eb6c49ba67a442ba85.zip
Make certain clients of bb_make_directory default to honoring
the user's umask
Diffstat (limited to 'libbb/make_directory.c')
-rw-r--r--libbb/make_directory.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libbb/make_directory.c b/libbb/make_directory.c
index d07ccb93c..d96acf0d9 100644
--- a/libbb/make_directory.c
+++ b/libbb/make_directory.c
@@ -49,7 +49,14 @@ int bb_make_directory (char *path, long mode, int flags)
49 struct stat st; 49 struct stat st;
50 50
51 mask = umask(0); 51 mask = umask(0);
52 umask(mask & ~0300); 52 if (mode == -1) {
53 umask(mask);
54 mode = (S_IXUSR | S_IXGRP | S_IXOTH |
55 S_IWUSR | S_IWGRP | S_IWOTH |
56 S_IRUSR | S_IRGRP | S_IROTH) & ~mask;
57 } else {
58 umask(mask & ~0300);
59 }
53 60
54 do { 61 do {
55 c = 0; 62 c = 0;