From: Ralph Boehme Date: Thu, 28 Oct 2021 08:18:17 +0000 (+0200) Subject: lib: update null_nttime() of -1: -1 is NTTIME_FREEZE X-Git-Tag: ldb-2.5.0~347 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5503bde93bddf3634b183e665773399c110251d4;p=thirdparty%2Fsamba.git lib: update null_nttime() of -1: -1 is NTTIME_FREEZE 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 Reviewed-by: Jeremy Allison --- diff --git a/lib/util/tests/time.c b/lib/util/tests/time.c index ee1fd42c8cf..33930a77173 100644 --- a/lib/util/tests/time.c +++ b/lib/util/tests/time.c @@ -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; } diff --git a/lib/util/time.c b/lib/util/time.c index 53bf194fe0b..e6a0668cf90 100644 --- a/lib/util/time.c +++ b/lib/util/time.c @@ -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; } /*******************************************************************