Is there a w开发者_运维技巧ay to find out in which function/file/line set the current errno?
Not that I know of, it's just a global static int (no magic in it) (see comment below).
You're supposed to check after each function that could set it when it returns an error.
Unfortunately not programmatically.
Just a thought: if this is a debugging issue, it might be possible to set a memory breakpoint on the address where the value of errno
is stored and have it break when the memory is written to. The call stack would then tell you who did it.
精彩评论