Age | Commit message (Collapse) | Author |
|
|
|
where the result is used. This avoids one unnecessary lstat call
per command line argument.
|
|
|
|
<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.
|
|
|
|
|
|
|
|
uses.
|
|
|
|
|
|
|
|
|
|
(remove_cwd_entries): Remove now-obsolete FIXME comment.
(remove_dir): Support rm's new --preserve-root option.
|
|
|
|
Don't define. These symbols are no longer used.
|
|
directories, as required by POSIX. Reported by Karl Berry.
|
|
now that that function no longer calls `error'.
|
|
adequate, since join.c uses alloca, yet lacked an in-file #pragma.
Remove `#pragma alloca'.
|
|
(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.
|
|
(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.
|
|
(readdir_ignoring_dotdirs): New function.
(is_empty_dir): Use it here.
(remove_cwd_entries): Use it here.
|
|
|
|
clobber errno. Spotted by Arnold Robbins.
|
|
so they can't be clobbered by the potential longjmp.
|
|
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.
|
|
|
|
the offending file, not just the basename.
|
|
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.
|
|
Remove declaration of euidaccess.
|
|
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.
|
|
|
|
|
|
|
|
|
|
* 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.
|
|
(full_filename_): When FILENAME is just `.'
and there is a nonempty directory-name part, don't append `/.'.
|
|
|
|
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.
|
|
|
|
|
|
|
|
don't recurse into directory, DIR.
|
|
|
|
Always close directory handle.
|
|
value.
|
|
failures. On some systems (at least EMC Celerra and Solaris5.8),
this appears to be necessary.
|
|
Give a diagnostic and fail if closedir fails.
|
|
(prompt): When not interactive, don't prompt for a symlink.
|
|
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.
|
|
check errno == EACCES. Otherwise, `rm dangling-symlink' would
mistakenly prompt.
|