[Nut-upsuser] Problem after reboot

Peter Selinger selinger at mathstat.dal.ca
Fri Mar 3 12:46:05 UTC 2006


I propose to rename the function fatal() as fatal_with_errno(), and
similarly upslog() as upslog_with_errno(). Reason: this is
self-documenting, and will help to avoid accidentally calling fatal()
in a situation where errno is not set. fatalx() and upslogx() would
remain as before.

Any objections? 

-- Peter

Peter Selinger wrote:
> 
> > No. The 'getpwnam(nut): Success' should not be displayed by the driver as
> > far as I can tell. Throughout the sources, the word 'getpwnam' is only
> > used to display a fatal error when NUT isn't able to locate a userid, in
> > this case for 'nut'. Where this 'Success' is coming from, is beyond me.
> 
> The reason for "Success" is that the code calls 
> 
>  fatal("getpwnam(%s)", user);
> 
> and not 
> 
>  fatalx("getpwnam(%s)", user);
> 
> While this fact is not widely documented, the only difference between
> the (badly named) procedures fatal() and fatalx() is that fatal()
> prints an error message based on errno, whereas fatalx() does not.  So
> one should only call fatal() in the case of an error condition that
> has actually set errno.




More information about the Nut-upsuser mailing list