tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: "%m" formatting code and "syslog like"



On Thu, Aug 30, 2018 at 01:11:23PM -0500, Ian Bruene wrote:
> 
> Hello
> 
> I am one of the developers on NTPsec and we are getting warnings on NetBSD
> 8.0 in the form:
> 
> ../../ntpd/ntp_io.c:1962:14: warning: %m is only allowed in syslog(3) like
> functions [-Wformat=]
> 
> This feature appears to have been added here:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67956
> 
> From googling I have been able to find the flag that is set for this warning
> to be suppressed, but we have not been able to find any documentation on how
> to properly identify a function as "syslog like"

Well, it is essentially (v)syslog. The point is that %m is not a generic
format string for all printf-like functions. That's a GNUism. Portable
code should use strerror explicitly.

Joerg


Home | Main Index | Thread Index | Old Index