File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,9 @@ bson_strerror_r (int err_code, /* IN */
130
130
// required) by the POSIX spec (see:
131
131
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strerror.html#tag_16_574_08).
132
132
(void ) strerror_r (err_code , buf , buflen );
133
- #elif defined(_XOPEN_SOURCE ) && _XOPEN_SOURCE >= 700
133
+ #elif (defined(_XOPEN_SOURCE ) && _XOPEN_SOURCE >= 700 ) || \
134
+ (defined(__FreeBSD_version ) && __FreeBSD_version >= 1203500 ) || \
135
+ defined(__MUSL__ )
134
136
// The behavior (of `strerror_l`) is undefined if the locale argument to
135
137
// `strerror_l()` is the special locale object LC_GLOBAL_LOCALE or is not a
136
138
// valid locale object handle.
@@ -170,6 +172,11 @@ bson_strerror_r (int err_code, /* IN */
170
172
// Unlikely, but continue supporting use of GNU extension in cases where the
171
173
// C Driver is being built without _XOPEN_SOURCE=700.
172
174
ret = strerror_r (err_code , buf , buflen );
175
+ #elif defined(__FreeBSD__ )
176
+ // FreeBSD has implemented strerror_l in 12.3 version, so this condition is needed for compatability.
177
+ if (strerror_r (err_code , buf , buflen ) != 0 ) {
178
+ ret = NULL ;
179
+ }
173
180
#else
174
181
#error "Unable to find a supported strerror_r candidate"
175
182
#endif
You can’t perform that action at this time.
0 commit comments