e9a7dce599eb12d "printing: Define and use methods to fetch/store time in share cache" broke time32
Michael Tokarev
mjt at tls.msk.ru
Tue Jan 20 22:06:21 UTC 2026
Hi!
When native time_t is 32bit, samba does not build anymore after
commit e9a7dce599eb12d:
source3/printing/printing.c:69:39: error: passing argument 3 of
‘tdb_fetch_int64’ from incompatible pointer type
[-Wincompatible-pointer-types]
69 | if (tdb_fetch_int64(tdb, key, curr_time) != 0) {
| ^~~~~~~~~
| |
| time_t * {aka long int *}
note: expected ‘int64_t *’ {aka ‘long long int *’} but argument is of
type ‘time_t *’ {aka ‘long int *’}
87 | int tdb_fetch_int64(struct tdb_context *tdb, const char
*keystr, int64_t *);
|
^~~~~~~~~
The code assumes time_t is int64_t, which might not be the case.
I guess an intermediate int64_t is needed here to pass to
tdb_fetch_int64(), and next to assign it to *curr_time:
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index a9e8422efab..afabf82c9bc 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -59,6 +59,7 @@ static int fetch_share_cache_time(const char *key_name,
time_t *curr_time)
{
char *key = NULL;
+ int64_t curr_time64;
key = talloc_asprintf(NULL, "%s/%s", key_name, sharename);
if (key == NULL) {
@@ -66,11 +67,12 @@ static int fetch_share_cache_time(const char *key_name,
return -1;
}
- if (tdb_fetch_int64(tdb, key, curr_time) != 0) {
+ if (tdb_fetch_int64(tdb, key, &curr_time64) != 0) {
DBG_ERR("No timing record found for[%s]!\n", sharename);
TALLOC_FREE(key);
return -1;
}
+ *curr_time = curr_time64;
TALLOC_FREE(key);
return 0;
Even if we don't care about systems with 32bit time_t, time_t isn't
necessary int64_t, it might be some other type.. maybe :)
Thanks,
/mjt
More information about the samba-technical
mailing list