Fixed file saving rules

pull/47/head
parent c2fed6088b
commit 89c3e99155

@ -41,7 +41,7 @@ int yon_file_save(char *file_path, char *text){
FILE *file = fopen(file_path,"w");
struct passwd *user = getpwnam(yon_ubl_root_user_get());
if (chown(file_path,user->pw_uid,user->pw_gid)){};
if (chmod(file_path,0755)){};
if (chmod(file_path,0644)){};
if (file){
fputs(text,file);
fclose(file);
@ -58,7 +58,7 @@ int yon_file_create(char *path, char *name, int rules){
if (fl){
struct passwd *user = getpwnam(yon_ubl_root_user_get());
if (chown(path,user->pw_uid,user->pw_gid)){};
if (chmod(path,0755)){};
if (chmod(path,0644)){};
fclose(fl);
return 1;
} else {
@ -83,7 +83,7 @@ int yon_file_create_full_path(char *path, mode_t rules){
if (!yon_char_is_empty(temp)){
if (access(temp,F_OK)){
if (i!=size-1){
mkdir(temp,0755);
mkdir(temp,0644);
struct passwd *user = getpwnam(yon_ubl_root_user_get());
} else {
FILE *fl = fopen(temp,"w");
@ -94,7 +94,7 @@ int yon_file_create_full_path(char *path, mode_t rules){
if (i>2){
struct passwd *user = getpwnam(yon_ubl_root_user_get());
int chown_success = chown(temp,user->pw_uid,user->pw_gid);
int chmod_success = chmod(temp,0755);
int chmod_success = chmod(temp,0644);
}
}
if (!yon_char_is_empty(current)) free(current);

Loading…
Cancel
Save