AnsweredAssumed Answered

open() returns file descriptor zero

Question asked by Greg Kogut on Oct 23, 2013
Latest reply on Oct 23, 2013 by Leonardo Sandoval Gonzalez

I have a problem where open() on either conventional files or serial port device handles returns file descriptor zero.    This has the effect of overwriting the default descriptor for stdin and returning the same file descriptor for different files. 

 

This has occurred on two different OSes (Linaro and Yocto), and two different i.XM6 Q7 modules (iWave and Congatec). 

 

It is likely not a coding error.  The code works correctly on x86.

 

I have worked around the issue by calling dup() after each open() in order to manually make process-unique descriptors.  This results in correct program behavior.     But I'd like to understand the root cause.   Any ideas?

Outcomes