diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2003-03-10 09:05:20 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2003-03-10 09:05:20 +0000 |
commit | 376ea96ca46fdfab3e61519eef361d96d1654e20 (patch) | |
tree | e9b5f154f5fe26d1688325fb1204534fb4da34ca | |
parent | 25c4393974ee859ad5e3f3edeb190987a5ce17cd (diff) | |
download | control-center-376ea96ca46fdfab3e61519eef361d96d1654e20.tar control-center-376ea96ca46fdfab3e61519eef361d96d1654e20.tar.gz control-center-376ea96ca46fdfab3e61519eef361d96d1654e20.tar.bz2 control-center-376ea96ca46fdfab3e61519eef361d96d1654e20.tar.xz control-center-376ea96ca46fdfab3e61519eef361d96d1654e20.zip |
- only the parent can see that fork() has failled ...
- display a splash error message if the program to execute is not executable
- prevent freeze if the program to exec() isn't executable.
else exec() faillure will have side effects that will badly freeze mcc since
child who should have overwrite mcc code will complete its execution by
running forked gtk+ object destructors (which will confuse X11 and badly
catch up its parent mcc).
so use POSIX::_exit(1) to prevent that and immediately return.
- sub processes faillures (such as those resulting from perl typos and the
like) are already nicely catched by new plug-added/plug-removed scheme and
SIG_CHILD handler
- one perl_checker fix
- package ChangeLog too
-rwxr-xr-x | control-center | 20 | ||||
-rw-r--r-- | drakconf.spec | 7 |
2 files changed, 18 insertions, 9 deletions
diff --git a/control-center b/control-center index e06491dc..0b6561ca 100755 --- a/control-center +++ b/control-center @@ -421,7 +421,7 @@ evil command line.")) ] $notebook_global->append_page($summary); -use POSIX qw(:sys_utsname_h :math_h sys_wait_h); +use POSIX qw(:sys_utsname_h :math_h :sys_wait_h :unistd_h); my (undef, $nodename, $release, undef, $machine) = POSIX::uname(); @@ -702,17 +702,23 @@ my @pid_exp; sub fork_ { my ($prog, $pid_table) = @_; $pid_table ||= \@pid_launched; - my $pid; - unless ($pid = fork()) { - splash_warning(N("cannot fork: %s", "$!")) unless defined $pid; - exec($prog); + my $pid = fork(); + if (defined $pid) { + !$pid and do { exec($prog) or POSIX::_exit(1) }; # immediate exit, else forked gtk+ object destructors will badly catch up parent mcc + push @$pid_table, $pid if $embedded; + } else { + splash_warning(N("cannot fork: %s", "$!")); + child_just_exited(); } - push @$pid_table, $pid if $embedded; } sub compute_exec_string { my ($icon, $log_exp, $exec_, $gtkplug, undef, $alternate) = @_; #($_[0], @{$_[1]}); my $exec = ref($exec_) ? $exec_->[0] : $exec_; + if (! -x first(split /\s+/, $exec)) { + splash_warning(N("cannot fork and exec \"%s\" since it is not executable", $exec)); + return; + } $exec .= " --summary" if $expert_wizard && $exec_ =~ /drakwizard/; if ($embedded && $gtkplug != -1) { # globally embedded and not "explicitely not embedded" $notebook_global->hide; @@ -773,7 +779,7 @@ sub launch_xapp { grep { /$name/ } <X>; }; my @before = &$find_windows(); - fork_("$exec"); + fork_($exec); my @after = &$find_windows(); require Time::HiRes; while (@after ne $xx + @before) { diff --git a/drakconf.spec b/drakconf.spec index 7b267a23..974a30b4 100644 --- a/drakconf.spec +++ b/drakconf.spec @@ -4,7 +4,7 @@ Summary: The Mandrake Control Center Name: drakconf Version: 9.1 -Release: 6mdk +Release: 7mdk # get the source from our cvs repository (see # http://www.linuxmandrake.com/en/cvs.php3) Source0: %name-%version.tar.bz2 @@ -77,7 +77,7 @@ rm -rf $RPM_BUILD_ROOT %files -f %{name}.lang %defattr(-,root,root) -%doc COPYING +%doc COPYING ChangeLog %config(noreplace) %ghost /etc/mcc.conf %config(noreplace) /etc/gnome-vfs-2.0/vfolders/* %_bindir/* @@ -93,6 +93,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Fri Mar 7 2003 Thierry Vignaud <tvignaud@mandrakesoft.com> 9.1-7mdk +- make mcc more robust against fork()/exec() faillures + * Thu Mar 6 2003 Thierry Vignaud <tvignaud@mandrakesoft.com> 9.1-6mdk - hide explanations for logdrake too since it's too big - update translations |