[PATCH] new bb_msg_and_syslog + sulogin clean up.

Rob Landley rob at landley.net
Thu Aug 24 22:05:56 UTC 2006


Having just received your resend, here's what I had to say the first time:

On Thursday 20 July 2006 4:47 pm, Tito wrote:
> Hi,
> this set of patches (2) contains a new bb_msg_and_syslog
> function for libbb  and shows the use of this new function in the sulogin
> applet.

I think this would be conceptually cleaner as three functions:

write_syslog() - just does the syslog
perror_syslog() - syslog and stderr
perror_syslog_and_die() - syslog and stderr, then die.

In theory each lower one is a wrapper around a higher one, but I'm not quite 
sure how to do the va_stuff handoff to get them both to work like printf.

Any debug_syslog() thing should be a macro that optimizes out if ENABLE_DEBUG 
is 0.  I don't think that's really required, though.

Closing the fd only if FEATURE_CLEAN_UP is set strikes me as dangerous.  What 
if dnsd or httpd starts using this?  The leaks can add up and get nasty after 
a while.

Hmmm...  I've been pondering consolidating show_usage(), error_msg(), 
error_msg_and_die(), perror_msg(), perror_msg_and_die(), vherror_msg(), 
herror_msg(), herror_msg_and_die(), perror_nomsg_and_die(), perror_nomsg(), 
verror_msg(), and vperror_msg().  They should all be in one .c file (ala 
llist.c or xfuncs.c).  This belongs in with that pile, although I won't be 
able to do that consolidation before this weekend.

I'm also likely to remove the bb_ prefixes at the same time because I really 
don't like them.  Nothing in libc has a prefix saying it's part of libc.  In 
zlib.h there are functions called inflateInit(), uncompress(), and adler32(), 
crc32(), typedefs called alloc_func and free_func...  You can see the FSF try 
to do these kind of prefixes in bfd.h, but at the same time typedef carsym 
and alent and such with no prefixes...  Our stuff is _not designed to be 
added randomly to third party programs, and the bb_ prefix for _ourselves_ is 
just silly...

The documentation says LOG_QUIET but the code says LOG_ONLY...

My fiancee is dragging me away to dinner.  More later...

Rob
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list