fix 64bit issue with time_t from database

This commit is contained in:
Andreas Steffen
2010-03-10 10:46:49 +01:00
parent a5166b16a1
commit d12ad4748a
+8 -2
View File
@@ -748,7 +748,8 @@ static void leases(char *filter, bool utc)
chunk_t address_chunk, identity_chunk; chunk_t address_chunk, identity_chunk;
int identity_type; int identity_type;
char *name; char *name;
u_int acquired, released, timeout; u_int db_acquired, db_released, db_timeout;
time_t acquired, released, timeout;
host_t *address; host_t *address;
identification_t *identity; identification_t *identity;
bool found = FALSE; bool found = FALSE;
@@ -760,7 +761,7 @@ static void leases(char *filter, bool utc)
exit(-1); exit(-1);
} }
while (query->enumerate(query, &name, &address_chunk, &identity_type, while (query->enumerate(query, &name, &address_chunk, &identity_type,
&identity_chunk, &acquired, &released, &timeout)) &identity_chunk, &db_acquired, &db_released, &db_timeout))
{ {
if (!found) if (!found)
{ {
@@ -773,6 +774,11 @@ static void leases(char *filter, bool utc)
address = host_create_from_chunk(AF_UNSPEC, address_chunk, 0); address = host_create_from_chunk(AF_UNSPEC, address_chunk, 0);
identity = identification_create_from_encoding(identity_type, identity_chunk); identity = identification_create_from_encoding(identity_type, identity_chunk);
/* u_int is not always equal to time_t */
acquired = (time_t)db_acquired;
released = (time_t)db_released;
timeout = (time_t)db_timeout;
printf("%-8s %-15H ", name, address); printf("%-8s %-15H ", name, address);
if (released == 0) if (released == 0)
{ {