file creation fixes

pull/36/head
parent 9d68c8aa71
commit fc7db60f16

@ -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;

Loading…
Cancel
Save