diff --git a/source/libublsettings.c b/source/libublsettings.c index 54e9dee..9aa99b7 100644 --- a/source/libublsettings.c +++ b/source/libublsettings.c @@ -2227,6 +2227,8 @@ config_str yon_file_open(char *file_path, int *size){ int yon_file_save(char *file_path, char *text){ FILE *file = fopen(file_path,"w"); + struct passwd *user = getpwnam(yon_ubl_root_user_get()); + chown(file_path,user->pw_uid,user->pw_gid); chmod(file_path,0777); if (file){ fputs(text,file); @@ -2241,8 +2243,9 @@ int yon_file_create(char *path, char *name, int rules){ char *full_path = yon_char_unite(path,"/",name,NULL); if (access(full_path,F_OK)){ FILE *fl = fopen(full_path,"w"); - chmod(full_path,0777); if (fl){ + struct passwd *user = getpwnam(yon_ubl_root_user_get()); + chown(path,user->pw_uid,user->pw_gid); chmod(full_path,rules); fclose(fl); return 1; @@ -2261,8 +2264,9 @@ int yon_file_create_full_path(char *path, int rules){ if (path){ if (access(path,F_OK)){ FILE *fl = fopen(path,"w"); - chmod(path,0777); if (fl){ + struct passwd *user = getpwnam(yon_ubl_root_user_get()); + chown(path,user->pw_uid,user->pw_gid); chmod(path,rules); fclose(fl); return 1;