[hackers] [sbase] mv: Ensure stat is initialized when we prune a tree || sin

From: <git_AT_suckless.org>
Date: Fri, 13 Nov 2015 15:21:11 +0100 (CET)

commit 2f4ab527391135e651b256f8654b050ea4a48f3d
Author: sin <sin_AT_2f30.org>
AuthorDate: Fri Nov 13 14:12:09 2015 +0000
Commit: sin <sin_AT_2f30.org>
CommitDate: Fri Nov 13 14:21:07 2015 +0000

    mv: Ensure stat is initialized when we prune a tree
    
    This can happen if you move a file from one filesystem to another.
    rename(2) will fail and we will fall through to a manual cp + rm.
    Initiate the rm through recurse() like we do for rm(1).
    
    Thanks to Heiko for reporting this.

diff --git a/mv.c b/mv.c
index e02bd8e..2cf98d1 100644
--- a/mv.c
+++ b/mv.c
_AT_@ -21,7 +21,7 @@ mv(const char *s1, const char *s2, int depth)
                 cp_aflag = cp_rflag = cp_pflag = 1;
                 cp_follow = 'P';
                 cp(s1, s2, depth);
- rm(s1, NULL, NULL, &r);
+ recurse(s1, NULL, &r);
                 return (mv_status = cp_status || rm_status);
         }
         mv_status = 1;
Received on Fri Nov 13 2015 - 15:21:11 CET

This archive was generated by hypermail 2.3.0 : Fri Nov 13 2015 - 15:24:11 CET