[patch] avoid invoking commands with empty argument

Adam Byrtek / alpha alpha at student.uci.agh.edu.pl
Tue Feb 11 18:00:07 UTC 2003


On Tue, Feb 11, 2003 at 12:07:50PM -0500, Pavel Roskin wrote:
> P.S. Empty string comes from edit_cmd_new().  It should be fine to use
> NULL if we take care not to run vfs_file_is_local() on NULL in
> execute_with_vfs_arg().

Your patch is better, it sorts things on higher level. I wanted to be
sure any other empty string will be converted to NULL in my_system(),
but I guess this is not necessary, and could even break things.

> What happens if EXECUTE_AS_SHELL is set, but command is NULL?  I
> understand that the shell won't be executed at all.  This is how it's
> called from view_other_cmd() if output_starts_shell is set.

Strange, this should never happen! 
This line:

        if (flags & EXECUTE_AS_SHELL)
            execl (shell, shell, "-c", command, NULL);

Invokes just a 'shell -c' when no command is given. I've just tested.
I've set show_output_starts_shell=1 and started cvs mc with 'mc -u',
and after Ctrl-O I saw only this before mc returned to panels:

 Type exit' to return to the Midnight Commander
                                               
 zsh: string expected after -c

Regards	    

-- 

  _.|._ |_  _.    : Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|    : gg 1802819, pgp 0xB25952C0
     |            : jid alpha.pl(at)jabber.org



More information about the mc-devel mailing list