[PATCH] correct_password: Handle NULL from crypt

Harald Becker ralda at gmx.de
Tue Feb 4 13:58:15 UTC 2014


Hi !

>>          char *res = crypt(clear, salt);
>>          if (!res)
>>                  res = "";
>>          return xstrdup(res);
>Yes, previously crypt returned an empty string like that. Though
>that will throw a warning about assigning a const char to char,
>something similar would work.

Why not ... ?


	char *res = crypt(clear, salt);
	return xstrdup(res ? res : "");

... this shall avoid the warning.

--
Harald


More information about the busybox mailing list