diff options
author | Matt Kraai <kraai@debian.org> | 2001-05-11 02:35:36 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2001-05-11 02:35:36 +0000 |
commit | f3e79ba6e3b3bfa380241205829d0a78570c9af3 (patch) | |
tree | 7778ed6ee8c7cab1d2bcd2b878592e4547ee840c | |
parent | 6e91f69a0d3105f78acbbf9f4e01d5b31fd0dfdf (diff) | |
download | busybox-w32-f3e79ba6e3b3bfa380241205829d0a78570c9af3.tar.gz busybox-w32-f3e79ba6e3b3bfa380241205829d0a78570c9af3.tar.bz2 busybox-w32-f3e79ba6e3b3bfa380241205829d0a78570c9af3.zip |
Fix symlink removal problem noted by Erik Andersen.
-rw-r--r-- | libbb/remove_file.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libbb/remove_file.c b/libbb/remove_file.c index 52b3211e6..23be40429 100644 --- a/libbb/remove_file.c +++ b/libbb/remove_file.c | |||
@@ -37,7 +37,7 @@ extern int remove_file(const char *path, int flags) | |||
37 | struct stat path_stat; | 37 | struct stat path_stat; |
38 | int path_exists = 1; | 38 | int path_exists = 1; |
39 | 39 | ||
40 | if (stat(path, &path_stat) < 0) { | 40 | if (lstat(path, &path_stat) < 0) { |
41 | if (errno != ENOENT) { | 41 | if (errno != ENOENT) { |
42 | perror_msg("unable to stat `%s'", path); | 42 | perror_msg("unable to stat `%s'", path); |
43 | return -1; | 43 | return -1; |
@@ -110,6 +110,7 @@ extern int remove_file(const char *path, int flags) | |||
110 | return status; | 110 | return status; |
111 | } else { | 111 | } else { |
112 | if ((!(flags & FILEUTILS_FORCE) && access(path, W_OK) < 0 && | 112 | if ((!(flags & FILEUTILS_FORCE) && access(path, W_OK) < 0 && |
113 | !S_ISLNK(path_stat.st_mode) && | ||
113 | isatty(0)) || | 114 | isatty(0)) || |
114 | (flags & FILEUTILS_INTERACTIVE)) { | 115 | (flags & FILEUTILS_INTERACTIVE)) { |
115 | fprintf(stderr, "%s: remove `%s'? ", applet_name, path); | 116 | fprintf(stderr, "%s: remove `%s'? ", applet_name, path); |