Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/fortune/fortune Close two file descriptors after using...



details:   https://anonhg.NetBSD.org/src/rev/2983d5f27291
branches:  trunk
changeset: 750875:2983d5f27291
user:      wiz <wiz%NetBSD.org@localhost>
date:      Sun Jan 17 22:52:00 2010 +0000

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

diffstat:

 games/fortune/fortune/fortune.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r d97a42ddf408 -r 2983d5f27291 games/fortune/fortune/fortune.c
--- a/games/fortune/fortune/fortune.c   Sun Jan 17 22:48:50 2010 +0000
+++ b/games/fortune/fortune/fortune.c   Sun Jan 17 22:52:00 2010 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index