Improve xmkdir

This commit is contained in:
topjohnwu 2017-06-30 23:22:51 +08:00
parent 8767a88854
commit 9e1aea33c3
3 changed files with 9 additions and 9 deletions

View File

@ -74,8 +74,8 @@ static int merge_img(const char *source, const char *target) {
if (n_total != t_total) if (n_total != t_total)
resize_img(target, n_total); resize_img(target, n_total);
mkdir(SOURCE_TMP, 0755); xmkdir(SOURCE_TMP, 0755);
mkdir(TARGET_TMP, 0755); xmkdir(TARGET_TMP, 0755);
char *s_loop, *t_loop; char *s_loop, *t_loop;
s_loop = mount_image(source, SOURCE_TMP); s_loop = mount_image(source, SOURCE_TMP);
if (s_loop == NULL) return 1; if (s_loop == NULL) return 1;
@ -332,7 +332,7 @@ static void clone_skeleton(struct node_entry *node) {
// Create the dummy file/directory // Create the dummy file/directory
if (IS_DIR(child)) if (IS_DIR(child))
mkdir(buf, 0755); xmkdir(buf, 0755);
else if (IS_REG(child)) else if (IS_REG(child))
close(open_new(buf)); close(open_new(buf));
// Links will be handled later // Links will be handled later
@ -540,10 +540,10 @@ void post_fs_data(int client) {
goto unblock; goto unblock;
if (new_img) { if (new_img) {
mkdir(COREDIR, 0755); xmkdir(COREDIR, 0755);
mkdir(COREDIR "/post-fs-data.d", 0755); xmkdir(COREDIR "/post-fs-data.d", 0755);
mkdir(COREDIR "/service.d", 0755); xmkdir(COREDIR "/service.d", 0755);
mkdir(COREDIR "/props", 0755); xmkdir(COREDIR "/props", 0755);
} }
// Run common scripts // Run common scripts

View File

@ -171,7 +171,7 @@ void start_daemon(int client) {
xmount(NULL, "/", NULL, MS_REMOUNT, NULL); xmount(NULL, "/", NULL, MS_REMOUNT, NULL);
create_links(NULL, "/sbin"); create_links(NULL, "/sbin");
xchmod("/sbin", 0755); xchmod("/sbin", 0755);
mkdir("/magisk", 0755); xmkdir("/magisk", 0755);
xchmod("/magisk", 0755); xchmod("/magisk", 0755);
xmount(NULL, "/", NULL, MS_REMOUNT | MS_RDONLY, NULL); xmount(NULL, "/", NULL, MS_REMOUNT | MS_RDONLY, NULL);

View File

@ -307,7 +307,7 @@ int xrename(const char *oldpath, const char *newpath) {
int xmkdir(const char *pathname, mode_t mode) { int xmkdir(const char *pathname, mode_t mode) {
int ret = mkdir(pathname, mode); int ret = mkdir(pathname, mode);
if (ret == -1) { if (ret == -1 && errno != EEXIST) {
PLOGE("mkdir %s %u", pathname, mode); PLOGE("mkdir %s %u", pathname, mode);
} }
return ret; return ret;