summaryrefslogtreecommitdiff
path: root/src/remove.c
AgeCommit message (Collapse)Author
2004-05-14(AD_pop_and_chdir): Eliminate an unnecessary call to AC_stack_top.Jim Meyering
2004-05-12(AD_pop_and_chdir): Move lstat-`.' into if-blockJim Meyering
where the result is used. This avoids one unnecessary lstat call per command line argument.
2004-05-10(AD_push): Don't use errno in diagnostic about `changed dev/ino'.Jim Meyering
2004-05-08Fix bug where "rm" gave up too easily, reported by Dan Jacobsen inJim Meyering
<http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>. (remove_entry): Check for errno values like ENOENT that show the file cannot be directory, instead of for errno values like EPERM that show the file might be a directory. This is necessary because, when a single unlink() call has multiple reasons to fail, it can set errno to any of those reasons; it's only the rare errno value like ENOENT that excludes all the other possible reasons to fail even when the file is a directory. (remove_cwd_entries): Don't attempt chdir if the file is known to not be a directory. (remove_dir): Use the same method that remove_cwd_entries uses (for some reason they differed). Don't assert that saved_errno must be EPERM; it might be just about anything.
2004-04-27(rm): Add `extern' keyword.Jim Meyering
2004-04-20(is_empty_dir): Clarify comment.Jim Meyering
2004-04-18(full_filename_): Don't leak upon failed realloc.Jim Meyering
2004-04-18(readdir_ignoring_dotdirs): Move function to system.h, renaming it. Update ↵Jim Meyering
uses.
2004-04-17(ds_init, ds_free): Declare functions to be `static'.Jim Meyering
2004-04-09undo last changeJim Meyering
2004-04-09Don't include "file-type.h", now that system.h does.Jim Meyering
2004-03-21(ds_free): Plug a small leak.Jim Meyering
2003-11-09Include "root-dev-ino.h".Jim Meyering
(remove_cwd_entries): Remove now-obsolete FIXME comment. (remove_dir): Support rm's new --preserve-root option.
2003-09-08Add a comment.Jim Meyering
2003-09-07(D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:Jim Meyering
Don't define. These symbols are no longer used.
2003-07-27(prompt) [! recursive]: Don't prompt about unwritableJim Meyering
directories, as required by POSIX. Reported by Karl Berry.
2003-07-12(remove_dir): Give a diagnostic upon failed save_cwd,Jim Meyering
now that that function no longer calls `error'.
2003-07-12It appears that the `#pragma alloca' included via "system.h" isJim Meyering
adequate, since join.c uses alloca, yet lacked an in-file #pragma. Remove `#pragma alloca'.
2003-05-04(HAVE_WORKING_READDIR): Define to 0 if not defined.Jim Meyering
(IF_READDIR_NEEDS_REWINDDIR): Remove. (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR, which was a bit weird because it couldn't be emulated by a function.
2003-05-02Work around nasty readdir bug with Darwin6.5 and hfs file system.Jim Meyering
(IF_READDIR_NEEDS_REWINDDIR): Define. [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just returned NULL and there has been at least one successful unlink or rmdir call since the opendir or previous rewinddir, then call rewinddir and reiterate the loop.
2003-05-02Factor out common code.Jim Meyering
(readdir_ignoring_dotdirs): New function. (is_empty_dir): Use it here. (remove_cwd_entries): Use it here.
2003-04-13(is_empty_dir): Don't closedir (NULL).Jim Meyering
2003-03-30(is_empty_dir): Don't let a failing closedirJim Meyering
clobber errno. Spotted by Arnold Robbins.
2003-03-16(rm): Put two local variables in static storage,Jim Meyering
so they can't be clobbered by the potential longjmp.
2003-03-09(AD_stack_pop): Cast sizeof... to int before changing its sign.Jim Meyering
This avoids a warning from gcc on 64-bit systems. (pop_dir): Reverse order of sign change and cast, to be consistent with the above.
2003-03-04(AD_pop_and_chdir): Call error here, now that restore_cwd no longer does it.Jim Meyering
2003-03-03(remove_cwd_entries): Include the full filename ofJim Meyering
the offending file, not just the basename.
2003-03-03(remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give anJim Meyering
accurate diagnostic when failing to remove a file owned by some other user. Reported by Ivo Timmermans via Michael Stone. This fixes Debian bug# 178471.
2003-02-14Include "euidaccess.h".Jim Meyering
Remove declaration of euidaccess.
2003-01-21(remove_entry) [ROOT_CAN_UNLINK_DIRS && HAVE_STRUCT_DIRENT_D_TYPE]: If a fileJim Meyering
has d_type == DT_UNKNOWN it may still be a directory -- or not (e.g., with FreeBSD on an NFS-mounted file system), so resort to calling lstat to find out.
2003-01-20Rename type: DS -> Dirstack_state.Jim Meyering
2003-01-20Remove some unnecessary parentheses.Jim Meyering
2003-01-07tweak commentJim Meyering
2003-01-07add a commentJim Meyering
2003-01-04rm could be tricked into mistakenly reporting a cycle.Jim Meyering
* 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.
2003-01-04Don't include trailing /. in diagnostics about directories.Jim Meyering
(full_filename_): When FILENAME is just `.' and there is a nonempty directory-name part, don't append `/.'.
2003-01-04(remove_cwd_entries): Fix typos in comment.Jim Meyering
2003-01-04(struct dirstack_state): Define.Jim Meyering
To be used in place of these file-scoped globals ... (dir_stack, len_stack, Active_dir): Remove globals. (ds_init, ds_free): New functions. (full_filename): Define. (full_filename_): Rename from full_filename. Begin to make AD_* functions more generic. (AD_push_initial): Don't set status to RM_OK here. (AD_push): Likewise. (AD_INIT_OTHER_MEMBERS): Define. (remove_dir): Define the `status' member manually after each call to AD_push or AD_push_initial.
2003-01-04[S_ISLNK]: Don't define. It's already defined in sys2.h.Jim Meyering
2002-12-15Remove all uses of `PARAMS'.Jim Meyering
2002-12-15(PARAMS): Remove definition.Jim Meyering
2002-10-05(remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',Jim Meyering
don't recurse into directory, DIR.
2002-09-06(prompt): Change comment to give a better note to translators.Jim Meyering
2002-08-29(is_empty_dir): Detect and diagnose readdir failures.Jim Meyering
Always close directory handle.
2002-08-29(remove_cwd_entries): Use closedir (not CLOSEDIR) when ignoring any return ↵Jim Meyering
value.
2002-08-29(remove_cwd_entries): Detect and diagnose readdirJim Meyering
failures. On some systems (at least EMC Celerra and Solaris5.8), this appears to be necessary.
2002-08-28(remove_cwd_entries): Use CLOSEDIR, not closedir.Jim Meyering
Give a diagnostic and fail if closedir fails.
2002-07-22rm would prompt for non-dangling symlinksJim Meyering
(prompt): When not interactive, don't prompt for a symlink.
2002-07-14Under some circumstances, rm would fail due to a lack ofJim Meyering
permissions, but give a misleading diagnostic like this: rm: cannot chdir from `.' to `foo': Not a directory (remove_dir): Detect the case in which unlinking a non-directory fails with EPERM, and give an appropriate diagnostic.
2002-07-04(prompt): Fix test for write-protectedness to alsoJim Meyering
check errno == EACCES. Otherwise, `rm dangling-symlink' would mistakenly prompt.