mirror of
https://github.com/systemd/systemd.git
synced 2024-10-27 18:55:40 +03:00
pwquality: fix use of ERRNO_IS_NOT_SUPPORTED
Given that ERRNO_IS_*() also match positive values, call ERRNO_IS_NOT_SUPPORTED() only if the value returned by pwq_allocate_context() is negative.
This commit is contained in:
parent
5bc9ea070f
commit
29dd2e253c
@ -107,10 +107,11 @@ int suggest_passwords(void) {
|
||||
int r;
|
||||
|
||||
r = pwq_allocate_context(&pwq);
|
||||
if (r < 0) {
|
||||
if (ERRNO_IS_NOT_SUPPORTED(r))
|
||||
return 0;
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to allocate libpwquality context: %m");
|
||||
}
|
||||
|
||||
suggestions = new0(char*, N_SUGGESTIONS+1);
|
||||
if (!suggestions)
|
||||
@ -140,10 +141,11 @@ int quality_check_password(const char *password, const char *username, char **re
|
||||
assert(password);
|
||||
|
||||
r = pwq_allocate_context(&pwq);
|
||||
if (r < 0) {
|
||||
if (ERRNO_IS_NOT_SUPPORTED(r))
|
||||
return 0;
|
||||
if (r < 0)
|
||||
return log_debug_errno(r, "Failed to allocate libpwquality context: %m");
|
||||
}
|
||||
|
||||
r = sym_pwquality_check(pwq, password, NULL, username, &auxerror);
|
||||
if (r < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user