|
|
|
|
@ -905,7 +905,7 @@ char *yon_ubl_root_user_get(){
|
|
|
|
|
FILE *file = popen("getent passwd $PKEXEC_UID | cut -d: -f1","r");
|
|
|
|
|
user=malloc(4096);
|
|
|
|
|
memset(user,0,4096);
|
|
|
|
|
fgets(user,4096,file);
|
|
|
|
|
if (fgets(user,4096,file)){};
|
|
|
|
|
user=yon_char_divide_search(user,"\n",-1);
|
|
|
|
|
fclose(file);
|
|
|
|
|
if (user) return user;
|
|
|
|
|
@ -918,7 +918,7 @@ char *yon_ubl_user_get_home_directory(){
|
|
|
|
|
FILE *path = popen(get_home_dir_command,"r");
|
|
|
|
|
char *ret = malloc(4096);
|
|
|
|
|
memset(ret,0,4096);
|
|
|
|
|
fgets(ret,4096,path);
|
|
|
|
|
if (fgets(ret,4096,path)){};
|
|
|
|
|
ret=yon_char_divide_search(ret,"\n",-1);
|
|
|
|
|
fclose(path);
|
|
|
|
|
return ret;
|
|
|
|
|
@ -2242,7 +2242,7 @@ 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);
|
|
|
|
|
if (chown(file_path,user->pw_uid,user->pw_gid)){};
|
|
|
|
|
chmod(file_path,0644);
|
|
|
|
|
if (file){
|
|
|
|
|
fputs(text,file);
|
|
|
|
|
@ -2259,7 +2259,7 @@ int yon_file_create(char *path, char *name, int rules){
|
|
|
|
|
FILE *fl = fopen(full_path,"w");
|
|
|
|
|
if (fl){
|
|
|
|
|
struct passwd *user = getpwnam(yon_ubl_root_user_get());
|
|
|
|
|
chown(path,user->pw_uid,user->pw_gid);
|
|
|
|
|
if (chown(path,user->pw_uid,user->pw_gid)){};
|
|
|
|
|
chmod(full_path,rules);
|
|
|
|
|
fclose(fl);
|
|
|
|
|
return 1;
|
|
|
|
|
|