Seems like @args is passed to cmdExecOrEval (e.g., when eval'ing
Pre/Pos commands) but not used in the function itself.
Same is true for the analogous cmdSystemOrEvalLong command.


# Exec or eval a command.  $cmd is either a string on an array ref.
#
# @args are optional arguments for the eval() case; they are not used
# for exec().
#
sub cmdExecOrEval
{
    my($bpc, $cmd, @args) = @_;
    
    if ( (ref($cmd) eq "ARRAY" ? $cmd->[0] : $cmd) =~ /^\&/ ) {
        $cmd = join(" ", @$cmd) if ( ref($cmd) eq "ARRAY" );
        print(STDERR "cmdExecOrEval: about to eval perl code $cmd\n")
                        if ( $bpc->{verbose} );
        eval($cmd);
        print(STDERR "Perl code fragment for exec shouldn't return!!\n");
        POSIX::_exit(1);
    } else {
        $cmd = [split(/\s+/, $cmd)] if ( ref($cmd) ne "ARRAY" );
        print(STDERR "cmdExecOrEval: about to exec ",
              $bpc->execCmd2ShellCmd(@$cmd), "\n")
                        if ( $bpc->{verbose} );
        alarm(0);
        $cmd = [map { m/(.*)/ } @$cmd];         # untaint
        #
        # force list-form of exec(), ie: no shell even for 1 arg
        #
        exec { $cmd->[0] } @$cmd;
        print(STDERR "Exec failed for @$cmd\n");
        POSIX::_exit(1);
    }
}


_______________________________________________
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

Reply via email to