aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);