diff --git a/source/libublsettings.c b/source/libublsettings.c index 54e9dee..33a26ca 100644 --- a/source/libublsettings.c +++ b/source/libublsettings.c @@ -664,6 +664,20 @@ int yon_char_parsed_check_exist(char **parameters, int size, char *param){ return -1; } + +int yon_char_parsed_strstr(char **parameters, int size, char *param){ + if (parameters){ + for (int i=0;ipw_uid,user->pw_gid); + chmod(file_path,0644); if (file){ fputs(text,file); fclose(file); @@ -2241,8 +2257,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; @@ -2260,21 +2277,33 @@ int yon_file_create(char *path, char *name, int rules){ 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){ - chmod(path,rules); - fclose(fl); - return 1; - } else { - return 0; + int size; + config_str parsed = yon_char_parse(path,&size,"/"); + char *current = ""; + for (int i=0;ipw_uid,user->pw_gid); + } + } + if (!yon_char_is_empty(current)) free(current); + current = temp; } + + return 1; } else { - return -1; + return 0; } - } else { - return 0; } + return 0; } config_str yon_file_list_dirs (char *path, int *size){ diff --git a/source/libublsettings.h b/source/libublsettings.h index 20b6ff5..dcc84a8 100644 --- a/source/libublsettings.h +++ b/source/libublsettings.h @@ -432,6 +432,8 @@ char **yon_char_parsed_rip(char **char_string, int *size, int item_to_delete); */ int yon_char_parsed_check_exist(char **parameters, int size, char *param); +int yon_char_parsed_strstr(char **parameters, int size, char *param); + /**yon_char_parsed_check_repeats(char **parameters, int size) * [EN] * Checks if [parameters] string array of length [size]