jailkit-users
[Top][All Lists]
Advanced

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

Re: [Jailkit-users] question on jk_lsh


From: Olivier Sessink
Subject: Re: [Jailkit-users] question on jk_lsh
Date: Sat, 12 Dec 2009 20:03:42 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Art Swri wrote:
Excuse my curiosity but I have a small question about jk_lsh.c (ver 2.10).
Lines 323-336 form a block statement in which 2 local vars (retval, logstring) are declared, execve() is called, and then retval is returned to the calling/invoking process. After the block is a 'return 0;' statement that is unreachable (because the block ends with an unconditional return). Is the block statement doing something more than just providing a namespace for the 2 variables? I assume the 'return 0' is there to suppress a compiler warning (for compilers that may not understand the 'return' in the block)?

you are correct. The code is in C89 style, which does not allow you to add a variable in the middle of a block. So the block just adds some variables. This could be cleaned much better. In C99 the block is not needed anymore, and thus the extra return is not needed anymore.

regards,
        Olivier





reply via email to

[Prev in Thread] Current Thread [Next in Thread]