Reason for failure:
There were two processes (process-1 and process-2) that ran in close sequel and tried to open this binary. Since my system (embedded device) crashes after this open call, the debugs that were broken were incorrect, and this made me suspect process-1. But the actual culprit is process-2, which opened the binary with the O_RDWR flag. But my file system (network connection) was mounted as a read-only file system .
Supports to pay attention to:
When updating perror print , this should be the correct cause of the problem: read-only file system . Therefore, my original description of perror should be the unclean value of any of the previous erroneous calls. One study is to use perror with caution to avoid parsing an error message.
Possible circumstances: an EINVAL error will be selected :
An open call will show EINVAL if we use O_SYNC (or) related flags for a file that we should not use. I do this based on documentation, as previously mentioned by Rafe.
source share