From 4bdf1a5da267a4f377a0085ad7346167fc6248b0 Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Fri, 16 Jan 2026 13:29:21 +0000 Subject: [PATCH] Created config owner fix --- source/ubinstall-gtk-configuration-mode.c | 47 ++++++++++++----------- source/ubinstall-gtk.c | 16 ++++---- ubinstall-gtk.glade | 15 -------- 3 files changed, 31 insertions(+), 47 deletions(-) diff --git a/source/ubinstall-gtk-configuration-mode.c b/source/ubinstall-gtk-configuration-mode.c index b7e72f4..79eff78 100644 --- a/source/ubinstall-gtk-configuration-mode.c +++ b/source/ubinstall-gtk-configuration-mode.c @@ -1,37 +1,38 @@ #include "ubinstall-gtk.h" int yon_configuration_path_check(const char *path){ - char *full_path = yon_char_new(path); - if (access(path,F_OK)){ - int homedir_create = 0; - int pos = yon_char_find_last((char*)path,'/'); - if (pos>-1){ - char *path_copy = yon_char_new(path); - char *dir_path = yon_char_divide(path_copy,pos); - if (access(dir_path,F_OK)){ - homedir_create = 1; - } - free(path_copy); - free(dir_path); - } else { - homedir_create = 1; - + char *full_path = NULL; + int homedir_create = 0; + int pos = yon_char_find_last((char*)path,'/'); + if (pos>-1){ + char *path_copy = yon_char_new(path); + char *dir_path = yon_char_divide(path_copy,pos); + if (access(dir_path,F_OK)){ + homedir_create = 1; } + free(path_copy); + free(dir_path); + } else { + homedir_create = 1; + + } + if (homedir_create){ + full_path = yon_char_unite(yon_ubl_user_get_home_directory(),"/",path,NULL); + } else { + full_path = yon_char_new(path); + } + if (access(full_path,F_OK)){ dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); data->action_text = homedir_create?CREATE_CONFIG_DIALOG_LABEL_HOMEDIR:CREATE_CONFIG_DIALOG_LABEL; data->title = WARNING_TITLE_LABEL; if (yon_confirmation_dialog_call(NULL,data)==GTK_RESPONSE_ACCEPT){ - if (homedir_create){ - free(full_path); - full_path = yon_char_unite(yon_ubl_user_get_home_directory(),"/",path,NULL); - } else { - free(full_path); - full_path = yon_char_new(path); - } yon_launch(ubconfig_file_create(full_path)); + struct passwd *user = getpwnam(yon_ubl_root_user_get()); + if (chown(full_path,user->pw_uid,user->pw_gid)){}; - } else return 0; + } } + main_config.config_load_path = full_path; if (!yon_char_is_empty(main_config.config_save_path)) free(main_config.config_save_path); main_config.config_save_path = yon_char_new(full_path); return 1; diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 8bbf85a..efdc1f1 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -515,7 +515,7 @@ void on_installer_language_changed(GtkWidget *self,GtkTreePath*,GtkTreeViewColum void yon_main_window_update_locale(main_window *widgets){ int size; char *command = yon_config_parameter_prepare_command(get_localisation_command,main_config.config_load_path,NULL,NULL); - config_str locale_output = yon_config_load(command,&size); + config_str locale_output = yon_config_load(yon_debug_output("%s\n",command),&size); char *locale = NULL; if (size&&strcmp(locale_output[0],"(null)\n")){ yon_char_remove_last_symbol(locale_output[0],'\n'); @@ -532,7 +532,7 @@ void yon_main_window_update_locale(main_window *widgets){ yon_char_parsed_free(locale_output,size); gtk_widget_destroy(widgets->MainWindow); - textdomain(LocaleName); + bind_textdomain_codeset(LocaleName,"UTF-8"); g_setenv("LANGUAGE",locale,1); yon_main_window_create(widgets); @@ -565,7 +565,7 @@ void set_locales_list(main_window *widgets){ qsort(locales,size,sizeof(char*),yon_char_parsed_compare); GtkTreeIter iter,itar; GHashTable *added = g_hash_table_new(g_str_hash,g_str_equal); - textdomain(LOCALES_DOMAIN_NAME); + bind_textdomain_codeset(LOCALES_DOMAIN_NAME,"UTF-8"); for (int i=0;iLicenceLabel),_(licence)); free(licence); - yon_char_parsed_free(parsed,size); - textdomain(LocaleName); + yon_char_parsed_free(parsed,size);bind_textdomain_codeset(LocaleName,"UTF-8"); } } gtk_builder_connect_signals(builder,NULL); @@ -1227,7 +1226,7 @@ main_window *yon_main_window_complete(){ int main(int argc, char *argv[]){ __attribute__((unused)) char *locale = setlocale(LC_ALL, ""); - textdomain (LocaleName); + bind_textdomain_codeset(LocaleName,"UTF-8"); config_init(); config_str unfound = NULL; int size=0; @@ -1258,7 +1257,6 @@ int main(int argc, char *argv[]){ } } gtk_init(&argc,&argv); - bind_textdomain_codeset(LocaleName,"UTF-8"); main_window *widgets = NULL; if (widgets){}; int fullscreen = 0; diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index dd07a65..2912814 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -300,21 +300,6 @@ - - True - False - - - 100 - 80 - True - True - - - - - - True False