Linux Standard Base Core Specification 4.0 | ||
---|---|---|
<<< Previous | Next >>> |
The fact that system() ignores interrupts is often not what a program wants. ISO POSIX (2003) describes some of the consequences; an additional consequence is that a program calling system() from a loop cannot be reliably interrupted. Many programs will want to use the exec() family of functions instead.
Do not use system() from a program with
suid
or sgid
privileges,
because unexpected values for some environment variables might be used
to subvert system integrity. Use the exec()
family of functions instead, but not execlp()
or execvp(). system() will
not, in fact, work properly from programs with suid
or sgid
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.)
The check for the availability of /bin/sh is not actually performed; it is always assumed to be available. ISO C (1999) specifies the check, but ISO POSIX (2003) specifies that the return shall always be nonzero, since a system without the shell is not conforming, and it is this that is implemented.
It is possible for the shell command to return
127, so that code is not a sure
indication that the execve() call failed; check
the global variable errno
to make sure.
<<< Previous | Home | Next >>> |
sysconf | Up | textdomain |