Module Name:    src
Committed By:   wiz
Date:           Sun Jan 17 22:52:00 UTC 2010

Modified Files:
        src/games/fortune/fortune: fortune.c

Log Message:
Close two file descriptors after using them. Found by cppcheck.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/games/fortune/fortune/fortune.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/fortune/fortune/fortune.c
diff -u src/games/fortune/fortune/fortune.c:1.62 src/games/fortune/fortune/fortune.c:1.63
--- src/games/fortune/fortune/fortune.c:1.62	Thu Aug 27 03:09:17 2009
+++ src/games/fortune/fortune/fortune.c	Sun Jan 17 22:52:00 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fortune.c,v 1.62 2009/08/27 03:09:17 dholland Exp $	*/
+/*	$NetBSD: fortune.c,v 1.63 2010/01/17 22:52:00 wiz Exp $	*/
 
 /*-
  * Copyright (c) 1986, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)fortune.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: fortune.c,v 1.62 2009/08/27 03:09:17 dholland Exp $");
+__RCSID("$NetBSD: fortune.c,v 1.63 2010/01/17 22:52:00 wiz Exp $");
 #endif
 #endif /* not lint */
 
@@ -233,6 +233,7 @@
 #ifdef LOCK_EX
 	(void) flock(fd, LOCK_UN);
 #endif /* LOCK_EX */
+	close(fd);
 #endif /* OK_TO_WRITE_DISK */
 	if (Wait) {
 		if (Fort_len == 0)
@@ -716,6 +717,7 @@
 		else
 			free(name);
 	}
+	(void) closedir(dir);
 	if (fp->num_children == 0) {
 		warnx("`%s': No fortune files in directory.", fp->path);
 		return FALSE;

Reply via email to