summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoruebayasi <uebayasi@openbsd.org>2015-06-25 02:04:07 +0000
committeruebayasi <uebayasi@openbsd.org>2015-06-25 02:04:07 +0000
commitf12e5d267fa16ace667943cdc0aa0c4c4112d6cf (patch)
tree440f37940ad1de54148c8f531e626c31a39ed119
parentyou need to include ddb/db_output.h so you know how to call db_printf (diff)
downloadwireguard-openbsd-f12e5d267fa16ace667943cdc0aa0c4c4112d6cf.tar.xz
wireguard-openbsd-f12e5d267fa16ace667943cdc0aa0c4c4112d6cf.zip
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@
-rw-r--r--bin/chmod/chmod.c3
-rw-r--r--bin/ls/ls.c4
-rw-r--r--usr.bin/compress/main.c4
-rw-r--r--usr.bin/du/du.c3
-rw-r--r--usr.bin/grep/util.c4
5 files changed, 11 insertions, 7 deletions
diff --git a/bin/chmod/chmod.c b/bin/chmod/chmod.c
index a1d7c240beb..d855f89ebbb 100644
--- a/bin/chmod/chmod.c
+++ b/bin/chmod/chmod.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: chmod.c,v 1.33 2014/12/13 20:59:24 guenther Exp $ */
+/* $OpenBSD: chmod.c,v 1.34 2015/06/25 02:04:08 uebayasi Exp $ */
/* $NetBSD: chmod.c,v 1.12 1995/03/21 09:02:09 cgd Exp $ */
/*
@@ -278,6 +278,7 @@ done:
}
if (errno)
err(1, "fts_read");
+ fts_close(ftsp);
exit(rval);
}
diff --git a/bin/ls/ls.c b/bin/ls/ls.c
index 2621788eaee..c4ef6592652 100644
--- a/bin/ls/ls.c
+++ b/bin/ls/ls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ls.c,v 1.40 2015/04/18 18:28:36 deraadt Exp $ */
+/* $OpenBSD: ls.c,v 1.41 2015/06/25 02:04:07 uebayasi Exp $ */
/* $NetBSD: ls.c,v 1.18 1996/07/09 09:16:29 mycroft Exp $ */
/*
@@ -403,6 +403,8 @@ traverse(int argc, char *argv[], int options)
}
if (errno)
err(1, "fts_read");
+
+ fts_close(ftsp);
}
/*
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;
}