Die "%m", die (was Re: [olsr-dev] [PATCH] Improvements in dot_draw plugin)

Bernd Petrovitsch (spam-protected)
Thu Jan 5 17:40:05 CET 2006

On Mon, 2005-11-14 at 22:02 +0100, Thomas Lopatic wrote:
> [...]
> > Hmm, the obvious replacement is to use `"%s", strerror(errno)`. But this
> > doesnt' help either.
> > So basically the question is: Should we kill the %m in olsr_syslog()
> > calls?
> > Or should we kill %m in all possibly non-Unix code?
> [...]
> I'd suggest that we move to the '"%s", strerror(errno)' combination.
> That's what we currently also use for printf()s. Luckily each source
The attached patch against cvs-current kills all %m which are used for
printf(), syslog() and the like and replaces them with the above

I also replaced the ones in the Unix-specific directories because
- to be able to check if with a simple 
find -type f -name '*.[ch]' -print0 | xargs -0r fgrep %m /dev/null
- no one should be tempted or able to copy-paste them into "wrong"
- it actually fixes bugs since several of them are called after
  e.g. OLSR_PRINTF() or perror() and they surely clobber "errno"

The patch will probably break compilation on Win* since it need #defines
at the top.

Also some returned values by ioctl() and similar sys-calls are compared
with "== -1" instead of "< 0" since it is defined that way.

Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services
-------------- next part --------------
A non-text attachment was scrubbed...
Name: olsrd-kill-percent-m.patch
Type: text/x-patch
Size: 12333 bytes
Desc: not available
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20060105/0676a833/attachment.bin>

More information about the Olsr-dev mailing list