set_lowest_fd()
QNX SDP8.0C Library ReferenceAPIDeveloper
Specify the lowest acceptable file descriptor
Synopsis:
#include <fcntl.h>
int set_lowest_fd( int fd );
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Arguments:
- fd
- The minimum file descriptor that you want to get.
Description:
The set_lowest_fd() function sets the lowest file descriptor number that will be returned by open(), pipe(), and other functions that return file descriptors. A process with the setuid/setgid file permission bit set can use this function at the begining of main() to ensure that it never unexpectedly gets back a file descriptor equal to 0, 1, or 2, which malicious programmers sometimes cause to happen by closing stdin, stdout, or stderr before spawning the process.
Returns:
The previous lowest number (0 for the first time it's called).
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | No |
Thread | No |
Page updated: