Using shell commands versus C equivalents

Joerg Sonnenberger joerg at britannica.bec.de
Wed Jun 13 15:57:34 UTC 2007


On Wed, Jun 13, 2007 at 08:26:38AM -0700, Garrett Cooper wrote:
> Sorry -- actually I meant that (along similar lines), there was a 
> program with the following lines:
> 
> vsystem("/bin/chmod +x %s", filename);
> 
> and I replaced it with:
> 
> chmod(filename, (mode_t) ( S_IXUSR | S_IXGRP | S_IXOTH ));

You supposedly mean stat + chmod here, right? Trivial errors like this
are easy to make.

> Next step, eliminating the linked list structure in favor or red-black 
> trees, maybe.

Due to the way pkg_install works, this most likely is just adding
complexity for no gain, it might actually slow it down.

Joerg


More information about the freebsd-hackers mailing list