]> git.ipfire.org Git - thirdparty/coreutils.git/commit
rm could be tricked into mistakenly reporting a cycle.
authorJim Meyering <jim@meyering.net>
Sat, 4 Jan 2003 10:07:44 +0000 (10:07 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 4 Jan 2003 10:07:44 +0000 (10:07 +0000)
commit8b6b22bcefc27f212b66d9d895a1809c885ac106
treed48f27bc68bf64350fe5f7dd770264f9bcda68ee
parente2b894c771ef46729aeffa0bd05d16e1bfb731f5
rm could be tricked into mistakenly reporting a cycle.
* src/remove.c: [cycle_check_state]: New global.
(remove_cwd_entries): Adapt to new semantics of cycle_check.
(rm): Call cycle_check_init and cycle_check_free for each file.

When rm detects a cycle, don't abort the entire command,
but rather just the affected command line argument.
* src/remove.c: Include <setjmp.h>
(struct dirstack_state) [current_arg_jumpbuf]: New member.
(remove_cwd_entries): Call longjmp if we detect a cycle.
(rm): Call setjmp here.

* src/remove.c (cycle_check, is_power_of_two): Remove functions.
Instead, include cycle-check.h and use it.
src/remove.c