Changeset 2c62767bb9d2621d30a9c9e625b84610aa0e46ca

Show
Ignore:
Timestamp:
12/14/11 20:02:47 (2 years ago)
Author:
Graham Knop <gknop@omniti.com>
git-committer:
Graham Knop <gknop@omniti.com> 1323892967 -0500
git-parent:

[cde08732a133017acb2bd02db7f4f8e6ea6817a5]

git-author:
Graham Knop <gknop@omniti.com> 1323892959 -0500
Message:

fix argument handling in Pgrep

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lib/Core/Pgrep.pm

    r92cfa46 r2c62767  
    7474    my $full = $config->{full} ? "f" : ""; 
    7575 
    76     my $args; 
     76    my @args; 
    7777    my $count; 
    7878    my @count; 
     
    8181      my $zonename = `zonename`; 
    8282      chomp $zonename; 
    83       $args .= "-z $zonename "
     83      push @args, '-z', $zonename
    8484    } 
    8585 
    8686    if ( $full ) { 
    87       $args .= "-f"
     87      push @args, '-f'
    8888    } 
    8989 
    90     # run_command acts oddly if $args is empty. pgrep throws an error. 
    91     if ( $args ) { 
    92       @count = split(/\n/, (run_command("$pgrep_path $args \'$config->{pattern}\'")) ); 
    9390 
    94     } 
    95     else { 
    96       @count = split(/\n/, (run_command("$pgrep_path", $config->{pattern})) ); 
    97     } 
     91    @count = split(/\n/, (run_command($pgrep_path, @args, $config->{pattern})) ); 
    9892    $count = scalar(@count); 
    9993