[Nut-upsdev] error handling in upssched.c

Charlie Brady charlieb-nut-upsdev at e-smith.com
Wed May 17 14:16:21 UTC 2006


On Wed, 17 May 2006, Charles Lepple wrote:

> In the man pages for system(3) on both OS X and Linux (Debian sarge),
> I do not see any mention of errno being set.
...
> I'm thinking that the return code should be tested with WIFEXITED,
> etc. instead of using errno, which may not have been updated by the C
> library when system() returned.

More correctly, errno was set by the C library in another process's 
context. If that process did not encode errno in the return status then 
the value is lost. Often programs will use errno in an error string they 
send to stderr, and then exit some fixed non-zero value.

So, yes, you shouldn't expect errno to be useful when system returns.

--
Charlie

A: Because we read from top to bottom, left to right.
Q: Why should i start my reply below the quoted text?




More information about the Nut-upsdev mailing list