Skip to content

Avoid using glibc-specific strerror_r variant #213

@rcombs

Description

@rcombs

IGC currently calls strerror_r and expects it to return a const char*:

errMsg = strerror_r(errCode, buf, sizeof(buf));

This is glibc-specific behavior. The POSIX behavior is for strerror_r to always write its output to the passed-in buffer, and to return an integer error code. This behavior is the only variant available in musl, the default on android bionic, and is available in glibc by defining the _POSIX_C_SOURCE macro to a value ≥ 200112L while not setting _GNU_SOURCE.

Could IGC set _POSIX_C_SOURCE before including headers in system.cpp and switch to expecting the POSIX behavior for this, to improve portability?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions