On Tuesday 16 May 2006 08:24, Peter Rundle allegedly wrote:
<snipped>
> Can you explain to a mere mortal why the following doesn't work?
> As a first step to your "trivial" challenge, I've written a simple C
> routine to
>
> system ("do something");
<snipped>
Read "man 3 system" as I suggested yesterday.
Of particular note may be this section;
Do not use system() from a program with set-user-ID or set-group-ID
privileges, because strange values for some environment variables might be
used to subvert system integrity. Use the exec(3) family of functions
instead, but not execlp(3) or execvp(3). system() will not, in fact, work
properly from programs with set-user-ID or set-group-ID privileges on
systems on which /bin/sh is bash version 2, since bash 2 drops privileges on
startup. (Debian uses a modified bash which does not do this when invoked as
sh.)
See "man 3 exec" for what you want.
Cheers,
Malcolm V.
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html