summaryrefslogtreecommitdiffhomepage
path: root/libbb/make_directory.c
diff options
context:
space:
mode:
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)
struct stat st;
mask = umask(0);
- umask(mask & ~0300);
+ if (mode == -1) {
+ umask(mask);
+ mode = (S_IXUSR | S_IXGRP | S_IXOTH |
+ S_IWUSR | S_IWGRP | S_IWOTH |
+ S_IRUSR | S_IRGRP | S_IROTH) & ~mask;
+ } else {
+ umask(mask & ~0300);
+ }
do {
c = 0;