if (archive_handle->flags & ARCHIVE_CREATE_LEADING_DIRS) {
char *name = bb_xstrdup(file_header->name);
- bb_make_directory (dirname(name), 0777, FILEUTILS_RECUR);
+ bb_make_directory (dirname(name), -1, FILEUTILS_RECUR);
free(name);
}
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;
#ifdef CONFIG_DEBUG
msg_logger( NO_DIE, LOG_INFO, "make_dir_tree()\n");
#endif
- if (bb_make_directory( dirname((char *)path), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH ,FILEUTILS_RECUR )==-1)
+ if (bb_make_directory( dirname((char *)path), -1, FILEUTILS_RECUR )==-1)
{
#ifdef CONFIG_DEBUG
msg_logger( NO_DIE, LOG_ERR, "make_dir_tree(): %s: %m\n", path);