Why does libc do this instead of simply returning that same negative number?
Legacy. It's always been this way and it can't change without breaking everything.
POSIX, basically. It was already a convention by the time linux/glibc implemented it.
Legacy. It's always been this way and it can't change without breaking everything.