tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: /bin/sh redirection in 'while' loop not closed afterwards?



On Mon, Sep 26, 2011 at 11:04:46PM +0200, Anthony Mallet wrote:
> Browsing through the code, I find this  (around /usr/src/bin/sh/redir.c:113)
> I guess it should be "char memory[11]", shouldn't it?
> 
> void
> redirect(union node *redir, int flags)
> {
> [...]
>       char memory[10];        /* file descriptors to write to memory */
> 
>       for (i = 10 ; --i >= 0 ; )
>               memory[i] = 0;

i is decremented before the loop is run.

Joerg


Home | Main Index | Thread Index | Old Index