[dev] [PATCH] cp: Don't modify status for -i

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.net>
Date: Tue, 22 Apr 2025 13:57:49 +0200

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.
---
 libutil/cp.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
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)
-- 
2.46.1
Received on Tue Apr 22 2025 - 13:57:49 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 22 2025 - 14:00:10 CEST