From 69ca20a1df7a5cae60e8a90e9ecdaa81dbc7dd9f Mon Sep 17 00:00:00 2001 From: Masao Uebayashi Date: Thu, 25 Jun 2015 02:04:09 +0000 Subject: Put fts_close() where missing. Not bugs in short-lived commands that call exit() -> _exit() immediately, but for idempotency. Originally found in ls(1) by Valgrind. Changes for other commands are from deraadt@. Reviewed by me, tested in snapshots. OK deraadt@ --- usr.bin/compress/main.c | 4 ++-- usr.bin/du/du.c | 3 ++- usr.bin/grep/util.c | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/compress/main.c b/usr.bin/compress/main.c index 4d91398b9a3..e9487918afa 100644 --- a/usr.bin/compress/main.c +++ b/usr.bin/compress/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.84 2015/05/03 19:44:59 guenther Exp $ */ +/* $OpenBSD: main.c,v 1.85 2015/06/25 02:04:08 uebayasi Exp $ */ /* * Copyright (c) 1992, 1993 @@ -463,7 +463,7 @@ main(int argc, char *argv[]) } if (list) list_stats(NULL, NULL, NULL); - + fts_close(ftsp); exit(rc); } diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c index ce223066ce2..51f48360e53 100644 --- a/usr.bin/du/du.c +++ b/usr.bin/du/du.c @@ -1,4 +1,4 @@ -/* $OpenBSD: du.c,v 1.29 2014/10/20 22:13:11 schwarze Exp $ */ +/* $OpenBSD: du.c,v 1.30 2015/06/25 02:04:08 uebayasi Exp $ */ /* $NetBSD: du.c,v 1.11 1996/10/18 07:20:35 thorpej Exp $ */ /* @@ -206,6 +206,7 @@ main(int argc, char *argv[]) if (cflag) { prtout((quad_t)howmany(totalblocks, blocksize), "total", hflag); } + fts_close(fts); exit(rval); } diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c index c4b945d4b36..39afe182dd4 100644 --- a/usr.bin/grep/util.c +++ b/usr.bin/grep/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.49 2014/12/01 06:36:04 deraadt Exp $ */ +/* $OpenBSD: util.c,v 1.50 2015/06/25 02:04:08 uebayasi Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -85,7 +85,7 @@ grep_tree(char **argv) } if (errno) err(2, "fts_read"); - + fts_close(fts); return c; } -- cgit v1.2.3