[Fedora-directory-commits] ldapserver/ldap/servers/slapd log.c, 1.28, 1.29

Noriko Hosoi nhosoi at fedoraproject.org
Thu Apr 16 20:11:15 UTC 2009


Author: nhosoi

Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv21668

Modified Files:
	log.c 
Log Message:
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.  



Index: log.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/log.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- log.c	16 Apr 2009 17:03:13 -0000	1.28
+++ log.c	16 Apr 2009 20:11:12 -0000	1.29
@@ -2598,7 +2598,7 @@
 			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 @@
 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




More information about the Fedora-directory-commits mailing list