diff options
| author | Greg Ercolano <erco@seriss.com> | 2020-07-11 14:35:59 -0700 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-14 12:52:56 +0200 |
| commit | 4471166f59499e011477a68c65141adf802d8cf4 (patch) | |
| tree | dc79654139febea60f47ee29f4ff06f89224680b /test | |
| parent | 0693c70f577624e66fd660a888f2d2bcd3fc180b (diff) | |
Extra fool-proofing, and suggested use of strerror_r()
strerror_r() sounds like the better thing to use, but if you
read the man page carefully, there are pitfalls of competing
GNU vs POSIX versions of the same function, with different
return values.
GNU version returns a pointer to the error string, which may
or may not use the error string supplied to use. Makes no sense.
Why not use the buffer the user prepared? Makes returning errors hard.
One thing GNU does underline is the string is always NUL terminated.
POSIX version doesn't return a string at all, it returns an int,
making handling the GNU cases impossible. POSIX /doesn't/ say
one way or the other about the string being NUL terminated, so
you have to make sure when you use it.
I trawled the net, seems this is a big annoying issue.
For now, leaving the code with strerror(), but we should change it.
Diffstat (limited to 'test')
0 files changed, 0 insertions, 0 deletions
