Make libc exit with a specific code if program initialization fails
Now you know, if a program exits with code -127 it's libc's fault :)
This commit is contained in:
parent
d5bc87099f
commit
1043b0772d
@ -16,8 +16,8 @@ static void check_for_file(int fd, FILE** target_stream, const char* path, const
|
|||||||
{
|
{
|
||||||
if (errno == EBADF) *target_stream = fopen(path, mode);
|
if (errno == EBADF) *target_stream = fopen(path, mode);
|
||||||
else
|
else
|
||||||
exit(errno);
|
exit(-127);
|
||||||
if (!*target_stream) exit(errno);
|
if (!*target_stream) exit(-127);
|
||||||
errno = 0;
|
errno = 0;
|
||||||
}
|
}
|
||||||
else { *target_stream = fdopen(fd, mode); }
|
else { *target_stream = fdopen(fd, mode); }
|
||||||
|
Loading…
Reference in New Issue
Block a user