Project

General

Profile

Feature #8041

ceph uses GCC-specific strerror_r; easy to make more portable

Added by Dan Mick almost 10 years ago. Updated almost 10 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
% Done:

0%

Source:
Development
Tags:
portability
Backport:
Reviewed:
Affected Versions:
Pull request ID:

Description

GCC's strerror_r returns the string; the POSIX version returns success (the string is returned in the supplied buffer, just as in the GCC version). Nothing but portability to be gained by using the POSIX version, and it's already pretty isolated to cpp_strerror() anyway.

Associated revisions

Revision d0a7632a (diff)
Added by Dan Mick almost 10 years ago

Use cpp_strerror() wherever possible, and use autoconf for portability

strerror_r is not portable; on Gnu libc it returns char * and sometimes
does not fill in the supplied buffer. Use autoconf to test which
version this platform uses and adapt.

Clean up the random calls to strerror and strerror_r (along with all
their private little one-use buffers) and regularize the code to use
cpp_strerror almost everywhere. Where changed, any negation of the
error code is also removed, since cpp_strerror() will do that.

Note: some tools were using their own calls to strerror/strerror_r, so
will now get a (%d) in their output that wasn't there before; hence
the change to test/cli/monmaptool/print-nonexistent.t

Fixes: #8041
Signed-off-by: Dan Mick <>

History

#1 Updated by Dan Mick almost 10 years ago

  • Tracker changed from Bug to Feature

#2 Updated by Dan Mick almost 10 years ago

  • Tags set to portability

#3 Updated by Dan Mick almost 10 years ago

  • Status changed from In Progress to Resolved

d0a7632a31258d0963dc5d4cf7502905cc8abfe7, merged into master at ab4a35f75eac161d2509e9e34853942fcc4ed6bb

Also available in: Atom PDF