Signed-off-by: Giorgi Tchankvetadze <[email protected]>
---
 coreutils/mv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/coreutils/mv.c b/coreutils/mv.c
index cf6169a1e..3a04096ad 100644
--- a/coreutils/mv.c
+++ b/coreutils/mv.c
@@ -157,7 +157,7 @@ int mv_main(int argc, char **argv)
                                                        goto RET_1;
                                                }
                                        }
-                                       if (unlink(dest) < 0) {
+                                       if ((dest_exists == 3 ? rmdir(dest) : 
unlink(dest)) < 0) {
                                                bb_perror_msg("can't remove 
'%s'", dest);
                                                goto RET_1;
                                        }
@@ -179,7 +179,7 @@ int mv_main(int argc, char **argv)
                        status = 1;
                }
  RET_0:
-               if (flags & OPT_VERBOSE) {
+               if ((flags & OPT_VERBOSE) && status == 0) {
                        printf("'%s' -> '%s'\n", *argv, dest);
                }
                if (dest != last) {
-- 
2.47.3

_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox

Reply via email to