Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix spurious crypt() warning in log
The crypt() function returns NULL on error, or the string otherwise. Only in the case of an error (i.e. NULL return) is the value of errno useful. On my system, crypt() works as expected, but errno is set to ENOENT, because the last system call that was executed tried to open '/proc/sys/crypto/fips_enabled', which does not exist on my system. However, crypt() works fine without that file, but doesn't reset errno to 0. This patch fixes that behaviour, by explicitly checking for a NULL return value, and only then examining errno. It also works around undefined behaviour (strcmp with a NULL argument), and makes sure that the password is considered NOT to match if crypt() fails.
- Loading branch information