summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoriko Hosoi <nhosoi@redhat.com>2009-04-16 20:11:12 +0000
committerNoriko Hosoi <nhosoi@redhat.com>2009-04-16 20:11:12 +0000
commit11a991f265f7676b3fceb22cdf05634d78f36a50 (patch)
tree22c6272561dc34a9c27ac3caee98b5312fd664d7
parent858a14c793073c5b18bd00d81d1a7641d041f9a0 (diff)
downloadds-11a991f265f7676b3fceb22cdf05634d78f36a50.tar.gz
ds-11a991f265f7676b3fceb22cdf05634d78f36a50.tar.xz
ds-11a991f265f7676b3fceb22cdf05634d78f36a50.zip
Resolves: #475338
Summary: LOG: the intenal type of maxlogsize, maxdiskspace and minfreespace should be 64-bit integer (comment #20) Description: In log_reverse_convert_time, by initializing "struct tm" with NULLs: struct tm tm = {0}; tm_isdst is also set to 0, which means no daylight saving. mktime thinks when converting struct tm to time_t, use the knowledge "the time that the time_t represents is not in the daylight saving period". Instead, we should have set "tm.tm_isdst = -1;". That means, we don't have the knowledge, calculate it in mktime. I also fixed a silly bug in generating a rotated log file name which I introduced in my previous checkin.
-rw-r--r--ldap/servers/slapd/log.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/ldap/servers/slapd/log.c b/ldap/servers/slapd/log.c
index cdf9f2b9..7241129f 100644
--- a/ldap/servers/slapd/log.c
+++ b/ldap/servers/slapd/log.c
@@ -2598,7 +2598,7 @@ log__fix_rotationinfof(char *pathname)
logp->l_ctime = log_reverse_convert_time(p);
PR_snprintf(rotated_log, rotated_log_len, "%s/%s",
- dirptr, dirent->name);
+ logsdir, dirent->name);
switch (log_type_id) {
case ERRORSLOG:
logp->l_size = log__getfilesize_with_filename(rotated_log);
@@ -4069,20 +4069,16 @@ static time_t
log_reverse_convert_time(char *tbuf)
{
struct tm tm = {0};
- time_t converted = 0;
if (strchr(tbuf, '-')) { /* short format */
strptime(tbuf, "%Y%m%d-%H%M%S", &tm);
- /* tm returned from strptime is one hour (3600 sec) advanced if
- * short format is used. Adjusting it to the original string.
- */
- converted = mktime(&tm) - 3600;
} else if (strchr(tbuf, '/') && strchr(tbuf, ':')) { /* long format */
strptime(tbuf, "%d/%b/%Y:%H:%M:%S", &tm);
- converted = mktime(&tm);
+ } else {
+ return 0;
}
-
- return converted;
+ tm.tm_isdst = -1;
+ return mktime(&tm);
}
int