1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-04 23:35:36 -08:00

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@
This commit is contained in:
uebayasi 2015-06-25 02:04:07 +00:00
parent b1791a29ad
commit f12e5d267f
5 changed files with 11 additions and 7 deletions

View File

@ -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);
}

View File

@ -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);
}
/*

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;
}