rizsotto / Bear

Bear is a tool that generates a compilation database for clang tooling.
GNU General Public License v3.0
4.76k stars 312 forks source link

preload sets errno #469

Closed Absolucy closed 2 years ago

Absolucy commented 2 years ago

Describe the bug The library preloaded by bear sets errno to EINVAL, which causes strange errors in software that checks for errno in functions.

To Reproduce

#include <stdlib.h>
#include <errno.h>
#include <string.h>

int main()
{
    printf("error %i: %s\n", errno, strerror(errno));
    return 0;
}
$ bear -- ./a.out
error 22: Invalid argument

Expected behavior

$ ./a.out 
error 0: Success

Environment:

Additional context N/A, bug is completely unrelated to build systems, and can be reliably reproduced on a basic 5-line executable.

Before you send...

rizsotto commented 2 years ago

thanks @Absolucy !