mkpasswd: simplify a check for errors

salt is a const char *, so we know that it cannot be modified as a side
effect.
This commit is contained in:
Marco d'Itri 2018-09-11 01:17:01 +02:00
parent c1cb4b2ca0
commit 61f4e5d64c

View File

@ -348,9 +348,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "crypt failed.\n");
exit(2);
}
/* yes, using strlen(salt_prefix) on salt. It's not
* documented whether crypt_gensalt may change the prefix */
if (!strneq(result, salt, strlen(salt_prefix))) {
if (!strneq(result, salt, strlen(salt))) {
fprintf(stderr, _("Method not supported by crypt(3).\n"));
exit(2);
}