Skip to content

Commit

Permalink
Better GTK2 and SELinux support.
Browse files Browse the repository at this point in the history
  • Loading branch information
megastep committed Mar 30, 2010
1 parent 641db10 commit be36605
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ esac

GTK_STATIC=$BSTATIC
case "$target" in
*linux*)
*i?86*linux*)
# Newer glibc's require to depend at least on them
STATIC=""
GTK_STATIC="\$(BDYNAMIC)" ;;
Expand Down
4 changes: 2 additions & 2 deletions copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ ssize_t copy_file(install_info *info, const char *cdrom, const char *path, const
mode = (int) strtol(mode_str, NULL, 8);
}

while ( (copied=file_read(info, buf, BUFSIZ, input)) > 0 ) {
while ( (copied=file_read(info, buf, sizeof(buf), input)) > 0 ) {
if ( file_write(info, buf, copied, output) != copied ) {
break;
}
Expand Down Expand Up @@ -409,7 +409,7 @@ ssize_t copy_file(install_info *info, const char *cdrom, const char *path, const
log_warning(_("Invalid SELinux context '%s' for file '%s'"), se_context, base);
}
# else
run_command(info, "chcon", se_context, final, 0);
run_command3(info, "chcon", "-ht", se_context, final, 0);
# endif
}
#endif
Expand Down
15 changes: 11 additions & 4 deletions gtk_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -1912,11 +1912,14 @@ static install_state gtkui_pick_class(install_info *info)
static void gtkui_idle(install_info *info)
{
#ifdef ENABLE_GTK2
/* if (g_main_context_pending(NULL))
g_main_context_iteration(NULL, FALSE); */
/*
if( gtk_events_pending() ) {
gtk_main_iteration_do(FALSE);
}
gtk_main_iteration();
} */
#else
while( gtk_events_pending() ) {
while( gtk_events_pending() == TRUE) {
gtk_main_iteration();
}
#endif
Expand Down Expand Up @@ -2210,7 +2213,11 @@ static void gtkui_shutdown(install_info *info)
window = glade_xml_get_widget(setup_glade_license, "license_dialog");
gtk_widget_hide(window);
}
gtkui_idle(info);
/* This seems to work better on GTK2 */
while( gtk_events_pending() == TRUE) {
gtk_main_iteration();
}
// gtkui_idle(info);
}

int gtkui_okay(Install_UI *UI, int *argc, char ***argv)
Expand Down
12 changes: 10 additions & 2 deletions install.c
Original file line number Diff line number Diff line change
Expand Up @@ -3052,18 +3052,24 @@ int run_script(install_info *info, const char *script, int arg, int include_tags
}

int run_command(install_info *info, const char *cmd, const char *arg1, const char *arg2, int warn)
{
return run_command3(info, cmd, arg1, arg2, NULL, warn);
}

int run_command3(install_info *info, const char *cmd, const char *arg1, const char *arg2, const char *arg3, int warn)
{
int exitval = 0;
pid_t child;

log_debug("Running command: '%s' '%s' '%s'\n", cmd, arg1 ? arg1 : "", arg2 ? arg2 : "");
log_debug("Running command: '%s' '%s' '%s' '%s'\n", cmd, arg1 ? arg1 : "", arg2 ? arg2 : "", arg3 ? arg3 : "");
switch( child = fork() ) {
case 0: {/* Inside the child */
char *argv[4];
argv[0] = strdup(cmd);
argv[1] = arg1 ? strdup(arg1) : NULL;
argv[2] = arg2 ? strdup(arg2) : NULL;
argv[3] = NULL;
argv[3] = arg3 ? strdup(arg3) : NULL;
argv[4] = NULL;
execvp(cmd, argv);
if ( warn ) {
perror("execv");
Expand All @@ -3074,6 +3080,8 @@ int run_command(install_info *info, const char *cmd, const char *arg1, const cha
free(argv[1]);
if (arg2)
free(argv[2]);
if (arg3)
free(argv[3]);
_exit(1);
}
case -1: /* Error */
Expand Down
1 change: 1 addition & 0 deletions install.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ extern void pop_curdir(void);

/* Run a program in the background */
int run_command(install_info *info, const char *cmd, const char *arg1, const char *arg2, int warn);
int run_command3(install_info *info, const char *cmd, const char *arg1, const char *arg2, const char *arg3, int warn);

/* Manage the list of corrupt files if we're restoring */
extern void add_corrupt_file(const product_t *prod, const char *path, const char *option);
Expand Down

0 comments on commit be36605

Please sign in to comment.