This content has been marked as final. Show 2 replies
Does the code compile cleanly without warnings? My guess is that 'stdin' might be defined as something other than the real stdin.
Try preprocessing your code (with -E) and check that your stdin is replaced with something like "(&__iob)".
Also, could some code be calling "close(0)"?
Run the process under truss and see if you see such a close() call.