# HG changeset patch # User corvid # Date 1269240501 0 # Node ID ec05ef8ca40ce64096e5e1a7c8aca512577e0360 # Parent 00e22d98bce83851908a7404c9867cc70d277941 fix reading maximum expiration date from cookies.txt I did check that tm.tm_sec was 0 before adding the max time to it, so that wasn't the problem. (max - 1000) was fine... Surely safer in general to do like this anyway, so I didn't spend time really digging into details this time. diff -r 00e22d98bce8 -r ec05ef8ca40c dpi/cookies.c --- a/dpi/cookies.c Mon Mar 22 01:11:39 2010 +0000 +++ b/dpi/cookies.c Mon Mar 22 06:48:21 2010 +0000 @@ -291,9 +291,14 @@ cookie->secure = TRUE; piece = dStrsep(&line_marker, "\t"); if (piece != NULL) { + /* There is some problem with simply putting the maximum value + * into tm.tm_sec (although a value close to it works). + */ + long seconds = strtol(piece, NULL, 10); struct tm tm; Cookies_tm_init(&tm); - tm.tm_sec += strtol(piece, NULL, 10); + tm.tm_min += seconds / 60; + tm.tm_sec += seconds % 60; cookie->expires_at = mktime(&tm); } else { cookie->expires_at = (time_t) -1;