Skip to content

Commit

Permalink
fix perm for mkdir
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Jul 13, 2015
1 parent 68ecf67 commit 6e4bcbf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/tbox/platform/posix/directory.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ tb_bool_t tb_directory_create(tb_char_t const* path)
tb_assert_and_check_return_val(path, tb_false);

// make it
tb_bool_t ok = !mkdir(path, S_IRWXU)? tb_true : tb_false;
tb_bool_t ok = !mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO)? tb_true : tb_false;
if (!ok)
{
// make directory
Expand All @@ -189,7 +189,7 @@ tb_bool_t tb_directory_create(tb_char_t const* path)
if (*p == '/')
{
// make directory if not exists
if (!tb_file_info(temp, tb_null)) mkdir(temp, S_IRWXU);
if (!tb_file_info(temp, tb_null)) mkdir(temp, S_IRWXU | S_IRWXG | S_IRWXO);

// skip repeat '/'
while (*p && *p == '/') p++;
Expand All @@ -198,7 +198,7 @@ tb_bool_t tb_directory_create(tb_char_t const* path)
}

// make it again
ok = !mkdir(path, S_IRWXU)? tb_true : tb_false;
ok = !mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO)? tb_true : tb_false;
}

// ok?
Expand Down
2 changes: 1 addition & 1 deletion src/tbox/platform/posix/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ tb_file_ref_t tb_file_init(tb_char_t const* path, tb_size_t mode)
if (*p == '/')
{
// make directory if not exists
if (!tb_file_info(temp, tb_null)) mkdir(temp, S_IRWXU);
if (!tb_file_info(temp, tb_null)) mkdir(temp, S_IRWXU | S_IRWXG | S_IRWXO);

// skip repeat '/'
while (*p && *p == '/') p++;
Expand Down

0 comments on commit 6e4bcbf

Please sign in to comment.