Comment by throwaway2037
2 days ago
> You can't check errno to see if there was a failure because, as the man page says, the value of errno is unspecified when crypt succeeds.
You can set errno to zero before the call. If the value is non-zero after the call, that is a good heuristic for failure.
...unless crypt() is one of the many, many functions which themselves internally call functions that set errno. In which case you can't be sure.