aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2019-06-04 12:18:53 +0200
committerOliver Smith <osmith@sysmocom.de>2019-06-04 12:41:54 +0200
commit63de00cfc104a32b5fb6abeeabaa631381c4cb36 (patch)
treecf9ae88960552a1e928579750a93af939191991d /src
parent1a1398ed54038ab0be3d1154260119836b7c2980 (diff)
db_hlr: zero-initialize "struct tm"
The last LU time gets read from the database as string, parsed with strptime to "struct tm", and then gets converted to time_t with mktime. A recent behavior change in glibc's mktime implementation unconvered, that we don't have tm.tm_isdst (daylight saving time) set properly. As "struct tm" was not initialized, and strptime did not write to tm_isdst, it was set to a random value. When it was not 0, db_test failed on UTC systems with a more recent glibc (e.g. Ubuntu 19.04). Fix this by zero-initializing "struct tm" and remove the previous workaround that made db_test pass on UTC systems. Related: OS#4026 Change-Id: Iebbbe42fc5cd43324206d9433ede67b39251389c
Diffstat (limited to 'src')
-rw-r--r--src/db_hlr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/db_hlr.c b/src/db_hlr.c
index 362dcf2..694ac53 100644
--- a/src/db_hlr.c
+++ b/src/db_hlr.c
@@ -445,7 +445,7 @@ static int db_sel(struct db_context *dbc, sqlite3_stmt *stmt, struct hlr_subscri
int rc;
int ret = 0;
const char *last_lu_seen_str;
- struct tm tm;
+ struct tm tm = {0};
/* execute the statement */
rc = sqlite3_step(stmt);