aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorkraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-05-11 02:35:36 +0000
committerkraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-05-11 02:35:36 +0000
commit41346c9b1c9c69b0ac47d2591697b66616c05b2b (patch)
tree7778ed6ee8c7cab1d2bcd2b878592e4547ee840c /libbb
parent7069048207eda7f8594d7c0b8826e4829c22422f (diff)
downloadbusybox-w32-41346c9b1c9c69b0ac47d2591697b66616c05b2b.tar.gz
busybox-w32-41346c9b1c9c69b0ac47d2591697b66616c05b2b.tar.bz2
busybox-w32-41346c9b1c9c69b0ac47d2591697b66616c05b2b.zip
Fix symlink removal problem noted by Erik Andersen.
git-svn-id: svn://busybox.net/trunk/busybox@2602 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb')
-rw-r--r--libbb/remove_file.c3
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);