Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libcrypt crypt does not return NULL anymore.



details:   https://anonhg.NetBSD.org/src/rev/12e639337bd1
branches:  trunk
changeset: 772308:12e639337bd1
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Dec 28 22:07:40 2011 +0000

description:
crypt does not return NULL anymore.

diffstat:

 tests/lib/libcrypt/t_crypt.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r f67c178318a3 -r 12e639337bd1 tests/lib/libcrypt/t_crypt.c
--- a/tests/lib/libcrypt/t_crypt.c      Wed Dec 28 20:40:25 2011 +0000
+++ b/tests/lib/libcrypt/t_crypt.c      Wed Dec 28 22:07:40 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_crypt.c,v 1.2 2011/12/27 01:24:27 christos Exp $ */
+/* $NetBSD: t_crypt.c,v 1.3 2011/12/28 22:07:40 christos Exp $ */
 
 /*
  * This version is derived from the original implementation of FreeSec
@@ -61,7 +61,7 @@
  *     by now.  The code requires a 32-bit integer type, though.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_crypt.c,v 1.2 2011/12/27 01:24:27 christos Exp $");
+__RCSID("$NetBSD: t_crypt.c,v 1.3 2011/12/28 22:07:40 christos Exp $");
 
 #include <atf-c.h>
 #include <stdio.h>
@@ -125,9 +125,13 @@
 {
        for (size_t i = 0; tests[i].hash; i++) {
                char *hash = crypt(tests[i].pw, tests[i].hash);
-               if (!hash && strlen(tests[i].hash) < 13)
+               if (!hash) {
+                       ATF_CHECK_MSG(0, "Test %zu NULL\n", i);
+                       continue;
+               }
+               if (strcmp(hash, "*0") == 0 && strlen(tests[i].hash) < 13)
                        continue; /* expected failure */
-               if (!hash || strcmp(hash, tests[i].hash))
+               if (strcmp(hash, tests[i].hash))
                        ATF_CHECK_MSG(0, "Test %zu %s != %s\n",
                            i, hash, tests[i].hash);
        }



Home | Main Index | Thread Index | Old Index