diff options
author | wiz <wiz@NetBSD.org> | 2010-01-17 22:52:00 +0000 |
---|---|---|
committer | wiz <wiz@NetBSD.org> | 2010-01-17 22:52:00 +0000 |
commit | 479176391beb2f89380dca6d726b14a1cd0ea8c5 (patch) | |
tree | c36b2c7844a072fa0b7ed9adca73cca921311cfa /fortune | |
parent | 96804ee7b7ed084b222560f92b26ab09824fc7c2 (diff) | |
download | bsdgames-darwin-479176391beb2f89380dca6d726b14a1cd0ea8c5.tar.gz bsdgames-darwin-479176391beb2f89380dca6d726b14a1cd0ea8c5.tar.zst bsdgames-darwin-479176391beb2f89380dca6d726b14a1cd0ea8c5.zip |
Close two file descriptors after using them. Found by cppcheck.
Diffstat (limited to 'fortune')
-rw-r--r-- | fortune/fortune/fortune.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fortune/fortune/fortune.c b/fortune/fortune/fortune.c index 42603f81..f9c8bdc8 100644 --- a/fortune/fortune/fortune.c +++ b/fortune/fortune/fortune.c @@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 1993\ #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 @@ main(int ac, char *av[]) #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 @@ add_dir(FILEDESC *fp) else free(name); } + (void) closedir(dir); if (fp->num_children == 0) { warnx("`%s': No fortune files in directory.", fp->path); return FALSE; |