Figuring out who installs errno

Is there any way to find out in which function / file / line the current errno is set?

+4
source share
2 answers

I don't know what I know, it's just a global static int (no magic) (see comment below).

You should check after every function that could install it when it returns an error.

+2
source

Unfortunately, not programmatically.

Just a thought: if this is a debugging problem, perhaps you can set a memory breakpoint at the address where errno is stored and cause it to break when it is written to memory. Then the call stack will tell you who did it.

+1
source

Source: https://habr.com/ru/post/1343774/


All Articles