]> git.ipfire.org Git - thirdparty/coreutils.git/commit
Make ls -R detect directory cycles.
authorJim Meyering <jim@meyering.net>
Thu, 1 Nov 2001 11:31:19 +0000 (11:31 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 1 Nov 2001 11:31:19 +0000 (11:31 +0000)
commit9e2756872d0467a4d8ced355dba65ef4e3c5fce3
treee5c685b551edb2f1b392556eee14133ef2fbe3b1
parentc1c9a579e3d1b311650d989dcc95f7ed1e655ad4
Make ls -R detect directory cycles.

Include hash.h, same.h, and xalloc.h.
(INITIAL_TABLE_SIZE, LOOP_DETECT): Define.
(active_dir_set): New global.
(struct dev_ino): Declare.
(dev_ino_hash, dev_ino_compare, dev_ino_free): New functions.
(visit_dir, free_pending_ent): New functions.
(main): Initialize the active_dir_set hash table, if necessary.
Don't confuse a marker entry with a real one.
Detect loops.
Manage the set of active directories.
Free the hash table.
(queue_directory): Add a new parameter.
Ensure that we set the new dev/ino members for each enqueued directory.
Update all callers.
(print_dir): Don't confuse a marker entry with a real one.
(extract_dirs_from_files): Insert a marker entry before inserting
the entries for subdirectories.
src/ls.c