> On Oct. 6, 2015, 5:09 p.m., Cong Wang wrote: > > 3rdparty/libprocess/3rdparty/stout/include/stout/error.hpp, line 37 > > <https://reviews.apache.org/r/39005/diff/1/?file=1091859#file1091859line37> > > > > When strerror_r() returns EINVAL, you return an empty string? > > Cong Wang wrote: > Also, you should force the XSI-compliant one rather than the GNU one > which returns a pointer.
> When strerror_r() returns EINVAL, you return an empty string? No, the here implementation might return something along the lines of `Unknown error: 12345` or whatever the `strerror_r` implementation in the active locale puts into the buffer, provided it fits into the buffer (if not: the error message gets truncated). IEEE-1003.1 `strerror` might set `errno` in case of errors and reserves no special return value. > Also, you should force the XSI-compliant one rather than the GNU one which > returns a pointer. I believe forcing glibc to use the XSI-compliant `strerror_r` isn't something we should try in a header-only implementation since it would require locally (re)defining some values via the preprocessor before include `stdio.h`; in a header we have zero control how the user includes our header. - Benjamin ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/39005/#review101665 ----------------------------------------------------------- On Oct. 8, 2015, 2:29 p.m., Benjamin Bannier wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/39005/ > ----------------------------------------------------------- > > (Updated Oct. 8, 2015, 2:29 p.m.) > > > Review request for mesos, Bernd Mathiske, Ben Mahler, and Till Toenshoff. > > > Bugs: MESOS-3551 > https://issues.apache.org/jira/browse/MESOS-3551 > > > Repository: mesos > > > Description > ------- > > This adds a thread-safe wrapper around strerror_r which has semantics similar > to strerror. We plan to use this at call sites currently relying on strerror. > > > Diffs > ----- > > 3rdparty/libprocess/3rdparty/stout/include/Makefile.am > 9e9c3119ad18f4cbc70c70095c71dc4fd19553df > 3rdparty/libprocess/3rdparty/stout/include/stout/os/strerror.hpp > PRE-CREATION > 3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp > e6d36ec1bf414b52d0899f0edf83e0ad8910dd0e > > Diff: https://reviews.apache.org/r/39005/diff/ > > > Testing > ------- > > make check > > > Thanks, > > Benjamin Bannier > >
