Browse Source

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.

Noriko Hosoi 16 years ago
parent
commit
11a991f265
1 changed files with 5 additions and 9 deletions
  1. 5 9
      ldap/servers/slapd/log.c

+ 5 - 9
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