]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: update null_nttime() of -1: -1 is NTTIME_FREEZE
authorRalph Boehme <slow@samba.org>
Thu, 28 Oct 2021 08:18:17 +0000 (10:18 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 28 Oct 2021 18:11:28 +0000 (18:11 +0000)
NTTIME_FREEZE is not a nil sentinel value, instead it implies special, yet
unimplemented semantics. Callers must deal with those values specifically and
null_nttime() must not lie about their nature.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14127

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/util/tests/time.c
lib/util/time.c

index ee1fd42c8cf0b422d954dc4d0fc79ee65f84e9bc..33930a77173b7efc7c134418313a18692b5eeaa8 100644 (file)
@@ -35,7 +35,7 @@ static bool test_null_time(struct torture_context *tctx)
 static bool test_null_nttime(struct torture_context *tctx)
 {
        torture_assert(tctx, null_nttime(0), "0");
-       torture_assert(tctx, null_nttime(NTTIME_FREEZE), "-1");
+       torture_assert(tctx, !null_nttime(NTTIME_FREEZE), "-1");
        torture_assert(tctx, !null_nttime(42), "42");
        return true;
 }
index 53bf194fe0b6336776e640d7c5a2404051966a2a..e6a0668cf90fffae8c86e01c5d80bc174e1c2c8d 100644 (file)
@@ -178,7 +178,7 @@ check if it's a null NTTIME
 **/
 _PUBLIC_ bool null_nttime(NTTIME t)
 {
-       return t == 0 || t == (NTTIME)-1;
+       return t == 0;
 }
 
 /*******************************************************************