Hi, On Wed, Jul 19, 2017 at 11:39:23PM +0200, Steffan Karger wrote: > Move strerror_ts() to error.c, which is a more suitable location than the > random collection of unrelated stuff called misc.c. While doing so, > simplify the implementation. > > (I think we should find a better place for everything currently in misc.c, > and get rid of it all together. This patch is part of that effort.)
While I do like the patch, parts of it do not make sense :-) > +#ifdef HAVE_STRERROR > +const char * > +strerror_ts(int errnum, struct gc_arena *gc) > +{ > + return string_alloc(openvpn_strerror(errnum, gc), gc); > +} > +#endif > + ... so where's the "#else" here? OTOH, the old code was a bit weird - #ifndef HAVE_STRERROR, the function itself would return a static string, but the *prototype* would disappear from the header file. I think we can safely assume that strerror() is available on all the platforms (so, kick out the test from configure.ac as well :) ) - but it might be worthwile to have a look at strerror_r() or strerror_s(), if we really are concerned about eventual threading OpenVPN and making this properly reentrant. As a side note, why anyone would implement strerror() in a non-thread- safe way ("it's only returning a pointer to a static string table, isn't it?") - reading through https://stackoverflow.com/questions/900338/why-cant-i-use-strerror has the answer: NLS, and "string tables dynamically loaded at run-time", so the string isn't actually static inside strerror(). gert -- USENET is *not* the non-clickable part of WWW! //www.muc.de/~gert/ Gert Doering - Munich, Germany g...@greenie.muc.de fax: +49-89-35655025 g...@net.informatik.tu-muenchen.de
signature.asc
Description: PGP signature
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel