- print "Processing $setup as user $user ...\n";
- # su is not used because it passes arguments through the shell,
- # which is not safe for untrusted setup file names.
- defined(my $pid = fork) or die "Can’t fork: $!";
- if (! $pid) {
- my ($uuid, $ugid) = (getpwnam($user))[2, 3];
- my $grouplist=join(" ", $ugid, $ugid, supplemental_groups($user));
- undef $!;
- $)=$grouplist;
- if ($!) {
- die "failed to set egid $grouplist: $!";
- }
- $(=$ugid;
- $<=$uuid;
- $>=$uuid;
- if ($< != $uuid || $> != $uuid || $( != $ugid) {
- die "failed to drop permissions to $user";
- }
- %ENV=(
- PATH => $ENV{PATH},
- HOME => (getpwnam($user))[7],
- );
- exec("ikiwiki", "-setup", $setup, @ARGV);
- die "failed to run ikiwiki: $!";
+ print "Processing $setup as user ".username()." ...\n";
+ my $ret=system("ikiwiki", "-setup", $setup, @ARGV);
+ if ($ret != 0) {
+ print STDERR "warning: processing $setup failed with code $ret\n";