[Nut-upsdev] error handling in upssched.c

Charles Lepple clepple at gmail.com
Wed May 17 13:25:49 UTC 2006


While looking into Laurent Lesage's problem with upssched, I noticed
something in exec_cmd():

http://boxster.ghz.cc/projects/nut/browser/trunk/clients/upssched.c#L79

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. The error code is
returned by system, and I am wondering if the "file not found" error
that Laurent saw was actually masking another problem.

I personally don't use upssched in production (if the power goes out,
chances are that the notification would not get through to me until
after the power returns), so are there any developers who would be
willing to help test some modifications to upssched?

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.

-- 
- Charles Lepple



More information about the Nut-upsdev mailing list