12 for $i ( 1,2,5,4,3 ) {
14 open(FH, "> $file") || die "can't create $file: $!";
15 print FH "not ok " . $j++ . "\n";
16 close(FH) || die "Can't close $file: $!";
24 @ARGV = mkfiles(1..3);
27 print STDOUT "# initial \@ARGV: [@ARGV]\n";
36 @ARGV = mkfiles(1..3);
39 print STDOUT "#final \@ARGV: [@ARGV]\n";
46 # test setuid is preserved (and hopefully setgid)
48 # With nested in-place editing PL_oldname and PL_filemode would
49 # be overwritten by the values for the last file in the nested
50 # loop. This is now all stored as magic in *ARGVOUT{IO}
52 @ARGV = mkfiles(1..3);
53 my $sidfile = $ARGV[1];
54 chmod(04600, $sidfile);
55 my $mode = (stat $ARGV[1])[2];
58 print STDOUT "#final \@ARGV: [@ARGV]\n";
64 my $newmode = (stat $sidfile)[2];
65 printf "# before %#o after %#o\n", $mode, $newmode;
66 print +($mode == $newmode ? "" : "not "). "ok 6 # check setuid mode preserved\n";
76 print STDOUT "# Calling other\n";
80 @ARGV = mkfiles(5, 4);
82 print STDOUT "# inner \@ARGV: [@ARGV]\n";
90 $files[$_] ||= tempfile();
92 my @results = @files[@_];
93 return wantarray ? @results : @results[-1];
96 END { unlink_all map { ($_, "$_.bak") } mkfiles(1..5) }