Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title Calling shell script error message
Ref. No. QNX.000009714
Category(ies) Filesystem
Issue I am making a program that calls a shell script. When the call is made, QNX outputs a following message and the shell script does not execute.

" invalid file descriptor to bufgets : 10"

1.What is the meaning of this message?
2.Does executing a shell script file from a program have any limitations?



Solution When a program executes another program (including a shell that runs the script), the default for the new program is to inherit all open fds of the parent.

The error message is from the shell and it is trying to inform you that it has too many open fds(the limit is 10).

The solution is that for the parent to change the default fd inheritance is that its children don't inherit fds by calling:

x09fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) _FD_CLOSE_ON_EXEC));