[hackers] [sbase] cp: Don't modify status for -i || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Tue, 22 Apr 2025 14:57:33 +0200 (CEST)

commit 11492947deec4e54e67da8cf1934767f02d146c1
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.net>
AuthorDate: Tue Apr 22 13:51:32 2025 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.net>
CommitDate: Tue Apr 22 13:57:36 2025 +0200

    cp: Don't modify status for -i
    
    Quoting POSIX:
    
            The following exit values shall be returned: 0 All requested files (excluding files where a non-affirmative response was given to a request for confirmation) were successfully copied. >0 An error occurred.

diff --git a/libutil/cp.c b/libutil/cp.c
index cd94858..2ab32a0 100644
--- a/libutil/cp.c
+++ b/libutil/cp.c
_AT_@ -44,10 +44,8 @@ cp(const char *s1, const char *s2, int depth)
         }
 
         if (cp_iflag && access(s2, F_OK) == 0) {
- if (!confirm("overwrite '%s'? ", s2)) {
- cp_status = 1;
+ if (!confirm("overwrite '%s'? ", s2))
                         return 0;
- }
         }
 
         if (cp_vflag)
Received on Tue Apr 22 2025 - 14:57:33 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 22 2025 - 15:00:43 CEST