- 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];
- $)="$ugid $ugid";
- $(=$ugid;
- $<=$uuid;
- $>=$uuid;
- if ($< != $uuid || $> != $uuid || $( != $ugid || $) ne "$ugid $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";