refactor get_salt function

refactor get_salt function to make it easier to read.
This commit is contained in:
juyin 2022-04-01 09:26:29 +08:00 committed by Serge Hallyn
parent 3732cf72d6
commit 3c1e5fcf16

View File

@ -394,11 +394,12 @@ static void close_files (void)
static const char *get_salt(void) static const char *get_salt(void)
{ {
if ( !eflg
&& ( (NULL == crypt_method)
|| (0 != strcmp (crypt_method, "NONE")))) {
void *arg = NULL; void *arg = NULL;
if (eflg || ((NULL != crypt_method) && (0 == strcmp (crypt_method, "NONE")))) {
return NULL;
}
if (md5flg) { if (md5flg) {
crypt_method = "MD5"; crypt_method = "MD5";
} }
@ -425,9 +426,6 @@ static const char *get_salt(void)
return crypt_make_salt (crypt_method, arg); return crypt_make_salt (crypt_method, arg);
} }
return NULL;
}
int main (int argc, char **argv) int main (int argc, char **argv)
{ {
char buf[BUFSIZ]; char buf[BUFSIZ];