OPNsense - FreeBSD source
Find a file
Peter Wemm abacbbbf01 Implement a -delete option to find. The code is extremely paranoid and
goes to a fair degree of trouble to enable something like this to
be safe:  cd /tmp && find . -mtime +7 -delete

It removes both files and directories.  It does not attempt to remove
immutable files (an earlier version I showed to a few people did a chflags
and tried to blow away even immutable files.  Too risky..)

It is thought to be safe because it forces the fts(3) driven descent to
only do "minimal risk" stuff.  specifically, -follow is disabled, it does
checking to see that it chdir'ed to the directory it thought it was
going to, it will *not* pass a pathname with a '/' character in it to
unlink(), so it should be totally immune to symlink tree races.  If it runs
into something "fishy", it bails out rather than blunder ahead.. It's better
to do that if somebody is trying to compromise security rather than risk
giving them an opportunity.  Since the unlink()/rmdir() is being called
from within the current working directory during the tree descent, there
are no fork/exec overheads or races.

As a side effect of this paranoia, you cannot do a
"find /somewhere/dir -delete", as the last argument to rmdir() is
"/somewhere/dir", and the checking won't allow it.  Besides, one would use
rm -rf for that case anyway. :-)

Reviewed by: pst (some time ago, but I've removed the immutable file
deletion code that he complained about since he last saw it)
1996-10-04 12:54:07 +00:00
bin re-activate the printf builtin now that src/usr.bin/printf.c has been 1996-10-01 04:59:13 +00:00
contrib Remove temporary hack to disable use of libstdc++ now that it's built and 1996-10-04 08:51:18 +00:00
eBones More ${.CURDIR} changes. 1996-10-01 15:20:29 +00:00
etc Add /usr/share/libg++ for libg++'s genclass prototype/template class 1996-10-03 21:44:47 +00:00
games Eliminated includes of the "temporary" backwards compatibility header 1996-09-24 08:08:11 +00:00
gnu To the Attic we go.. 1996-10-04 09:02:59 +00:00
include Add support for storing a -R path in ld in the section dispatch table, 1996-10-01 00:25:32 +00:00
lib Skip results that have unexpected lengths 1996-10-01 03:45:06 +00:00
libexec There's no need to 'unsetenv()' unsafe environment variables explicitly 1996-10-01 16:09:18 +00:00
lkm add forgotten $Id$ 1996-09-22 21:56:57 +00:00
release Temporarily disable userconfig saving until I figure out why uc_open() 1996-10-03 08:54:37 +00:00
sbin Back out my -k changes; there's a better way to do this in the short-term. 1996-10-02 07:22:26 +00:00
secure cmp -s || install -c --> install -C 1996-08-30 04:07:04 +00:00
share Relax the argument checking - it caused it to fail in the perfectly 1996-10-04 12:30:16 +00:00
sys Implemented a more sophisticated mechanism for finding the chip iobase 1996-10-04 10:33:13 +00:00
tools Fixed CLEANFILES. The *.3 links were missing. 1996-09-20 14:12:32 +00:00
usr.bin Implement a -delete option to find. The code is extremely paranoid and 1996-10-04 12:54:07 +00:00
usr.sbin Temporarily disable userconfig saving until I figure out why uc_open() 1996-10-03 08:54:37 +00:00
COPYRIGHT This is the official 4.4 Lite copyright. 1994-09-11 07:53:28 +00:00
Makefile Add some 'world' hooks for libg++-2.7.2, specifically the new libstdc++ 1996-10-04 08:48:27 +00:00