Date: Thu, 10 Jan 2019 08:53:27 -0500 From: "Christos Zoulas" <chris...@netbsd.org> Message-ID: <20190110135327.189a1f...@cvs.netbsd.org>
| PR/53851: Andreas Gustafsson: libwrap prints "m" instead of errno | Handle %m inline if needed, otherwise vasprintf strips the %m and... That change handles the simple case of %m but fails on %%m (though that is, I assume, unlikely, in libwrap error messages). The simple change, making the test be ... if ((ptr = strstr(fmt, "%m")) != NULL && (ptr == fmt || ptr[-1] != '%')) fails on %%%m (though I would guess that is even less likely). There's no good way to correctly fix this using this technique, what is needed is to do as the syslog() functions do, and actually do a (restricted) parse of the format string. For this though, I suspect it would be overkill. The point of this message is just to make sure everyone is aware of this, and perhaps, if there is some suitable place to document it, that that be done. Oh for the ability to simply add application specific format specifiers to printf - I think plan9 has something along those lines. It would be farily easy to add, if only gcc didn't go and do printf format string analysis and complain when it sees something it does not understand. kre