[30219] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Fix assert hygiene in t_path.c

daemon@ATHENA.MIT.EDU (Greg Hudson)
Fri Jun 8 00:52:56 2018

Date: Fri, 8 Jun 2018 00:52:49 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-Id: <201806080452.w584qnUk003121@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/46b7940cd8cabb29c62fc063854d7eaeb906b902
commit 46b7940cd8cabb29c62fc063854d7eaeb906b902
Author: Greg Hudson <ghudson@mit.edu>
Date:   Wed Jun 6 18:33:59 2018 -0400

    Fix assert hygiene in t_path.c
    
    Correct all uses of side-effecting asserts in t_path.c so that it
    works correctly when NDEBUG is defined.  Reported by Nehal J Wani.
    
    ticket: 8689

 src/util/support/t_path.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/util/support/t_path.c b/src/util/support/t_path.c
index 2ac91d8..111c27a 100644
--- a/src/util/support/t_path.c
+++ b/src/util/support/t_path.c
@@ -136,12 +136,16 @@ main(void)
         edirname = split_tests[i].posix_dirname;
         ebasename = split_tests[i].posix_basename;
 #endif
-        assert(k5_path_split(ipath, NULL, NULL) == 0);
-        assert(k5_path_split(ipath, &dirname, NULL) == 0);
+        if (k5_path_split(ipath, NULL, NULL) != 0)
+            abort();
+        if (k5_path_split(ipath, &dirname, NULL) != 0)
+            abort();
         free(dirname);
-        assert(k5_path_split(ipath, NULL, &basename) == 0);
+        if (k5_path_split(ipath, NULL, &basename) != 0)
+            abort();
         free(basename);
-        assert(k5_path_split(ipath, &dirname, &basename) == 0);
+        if (k5_path_split(ipath, &dirname, &basename) != 0)
+            abort();
         if (strcmp(dirname, edirname) != 0) {
             fprintf(stderr, "Split test %d: dirname %s != expected %s\n",
                     (int)i, dirname, edirname);
@@ -164,7 +168,8 @@ main(void)
 #else
         ejoined = join_tests[i].posix_result;
 #endif
-        assert(k5_path_join(path1, path2, &joined) == 0);
+        if (k5_path_join(path1, path2, &joined) != 0)
+            abort();
         if (strcmp(joined, ejoined) != 0) {
             fprintf(stderr, "Join test %d: %s != expected %s\n",
                     (int)i, joined, ejoined);
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post