diff options
Diffstat (limited to 'libbb')
| -rw-r--r-- | libbb/make_directory.c | 9 |
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; |
