Le Mar 1 mar 19:17:20 2005, Per Jessen écrit: > Laurent Wacrenier wrote: > > > /bin/sh is a reasonable default, but you can't assert the system shell > > is here. It may live in a lot of places like /bin/posix/sh, /usr/bin/sh > > /usr/xpg4/bin/sh... > > Fair enough. > I'll use _PATH_BSHELL from <paths.h> instead - > > http://jessen.ch/files/patch-clamav-0.83-freshclam-with-fork3
That's better, but this include is not standart and may not exists everywhere. In HPUX, the system() shell is /bin/posix/sh (or /usr/bin/sh on some versions) and path.h is not here. In Solaris, the system() shell may be /usr/xpg4/bin/sh or /usr/bin/sh according the __EXTENSIONS__ macro. path.h is still not here. Anyway, in both cases, /bin/sh exists and point to a shell (the non POSIX shell on Solaris). A POSIX way is to call the wordexp() routine (prefer at process initialization) to split the line in argument then use execvp(). You may also simply want to fork before to call system(). _______________________________________________ http://lurker.clamav.net/list/clamav-devel.html