Using shell commands versus C equivalents

Joerg Sonnenberger joerg at britannica.bec.de
Wed Jun 13 16:26:34 UTC 2007


On Wed, Jun 13, 2007 at 11:15:52AM -0500, Rick C. Petty wrote:
> Another improvement made by using stat(2)/chmod(2) over chmod(1) using
> system(3) variants is the protection against malicious filenames.  The
> original code should have used fork/execv instead anyway.

To be precise, this case should use open/fstat/fchmod to avoid another
bunch of race conditions.

Joerg


More information about the freebsd-hackers mailing list