[PATCH] Fix debug message in gencache

Andreas Schneider asn at samba.org
Thu Jan 17 13:05:27 UTC 2019


Hi,

here is a small patch to fix a debug message.


Review much appreciated!


Thanks,


	Andreas

-- 
Andreas Schneider                      asn at samba.org
Samba Team                             www.samba.org
GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D
-------------- next part --------------
>From 0c293574062ab50f6df7323d2622c48a83dce451 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 17 Jan 2019 13:58:14 +0100
Subject: [PATCH] s3:lib: Fix the debug message for adding cache entries.

To get correct values, we need to cast 'timeout' to 'long int' first in
order to do calculation in that integer space! Calculations are don in
the space of the lvalue!

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/lib/gencache.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c
index d6ef28c140f..9ad85bbf55f 100644
--- a/source3/lib/gencache.c
+++ b/source3/lib/gencache.c
@@ -219,11 +219,11 @@ bool gencache_set_data_blob(const char *keystr, DATA_BLOB blob,
 	dbufs[2] = (TDB_DATA) { .dptr = (uint8_t *)&crc,
 				.dsize = sizeof(crc) };
 
-	DEBUG(10, ("Adding cache entry with key=[%s] and timeout="
-	           "[%s] (%d seconds %s)\n", keystr,
+	DBG_DEBUG("Adding cache entry with key=[%s] and timeout="
+	           "[%s] (%ld seconds %s)\n", keystr,
 		   timestring(talloc_tos(), timeout),
-		   (int)(timeout - time(NULL)), 
-		   timeout > time(NULL) ? "ahead" : "in the past"));
+		   ((long int)timeout) - time(NULL),
+		   timeout > time(NULL) ? "ahead" : "in the past");
 
 	ret = tdb_chainlock(cache->tdb, key);
 	if (ret == -1) {
-- 
2.20.1



More information about the samba-technical mailing list