Re: [patch] avoid invoking commands with empty argument



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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]