]> git.tuebingen.mpg.de Git - paraslash.git/commit
error.h: Never call (para_)strerror() on osl errors.
authorAndre Noll <maan@tuebingen.mpg.de>
Wed, 12 Aug 2015 17:24:50 +0000 (19:24 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 27 Sep 2015 13:25:40 +0000 (13:25 +0000)
commit9bf6dc2eaf7b3252fb7db73ed8ead6f568bbb0ec
treecfae1e291ec9f38e6abe03ff167cde222ed17c83
parent1fd34762208566dfe2d2e07772e4af088f833a2b
error.h: Never call (para_)strerror() on osl errors.

In the (inlined) function para_strerror() of error.h we compile in
the call to osl_strerror() if and only if osl.h has been included
(in which case the preprocessor macro _OSL_H is defined). This is
wrong because an osl error code might well be passed to a function
defined in a compilation unit which does not include osl.h. If this
function calls para_strerror(), we will segfault or worse.

We need to check at link time whether osl_strerror is a defined
symbol rather than checking a preprocessor macro at compile time.
Fortunately, a little linker fu helps us out here. This patch
introduces a weak reference to osl_strerror to tell whether
osl_strerror is defined.
error.h