svn commit: r208828 - head/usr.bin/calendar

Edwin Groothuis edwin at FreeBSD.org
Sat Jun 5 11:41:46 UTC 2010


Author: edwin
Date: Sat Jun  5 11:41:46 2010
New Revision: 208828
URL: http://svn.freebsd.org/changeset/base/208828

Log:
  Fix warnings about uninitialized variables.
  It was mostly harmless since strftime() only used %a and %b anyway.
  
  Found with:   Coverity Prevent(tm)
  CID:          7769

Modified:
  head/usr.bin/calendar/locale.c

Modified: head/usr.bin/calendar/locale.c
==============================================================================
--- head/usr.bin/calendar/locale.c	Sat Jun  5 11:32:31 2010	(r208827)
+++ head/usr.bin/calendar/locale.c	Sat Jun  5 11:41:46 2010	(r208828)
@@ -76,6 +76,7 @@ setnnames(void)
 	int i, l;
 	struct tm tm;
 
+	memset(&tm, sizeof(struct tm), 0);
 	for (i = 0; i < 7; i++) {
 		tm.tm_wday = i;
 		strftime(buf, sizeof(buf), "%a", &tm);
@@ -103,6 +104,7 @@ setnnames(void)
 		fndays[i].len = strlen(buf);
 	}
 
+	memset(&tm, sizeof(struct tm), 0);
 	for (i = 0; i < 12; i++) {
 		tm.tm_mon = i;
 		strftime(buf, sizeof(buf), "%b", &tm);


More information about the svn-src-head mailing list