blob: 6428a9803379bbc1bee724feb8ef80e16e9fde56 [file] [log] [blame]
Colin Cross4bea6552021-12-21 13:54:40 -08001//
2// Copyright (C) 2021 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17/* Undefine _GNU_SOURCE so that this compilation unit can access the
18 * posix version of strerror_r */
19#undef _GNU_SOURCE
20#include <string.h>
21
22namespace android {
23namespace base {
24
25extern "C" int posix_strerror_r(int errnum, char* buf, size_t buflen) {
26#ifdef _WIN32
27 return strerror_s(buf, buflen, errnum);
28#else
29 return strerror_r(errnum, buf, buflen);
30#endif
31}
32
33} // namespace base
34} // namespace android