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

0 views
Skip to first unread message

Roberto E. Vargas Caballero

unread,
Apr 22, 2025, 7:59:01 AMApr 22
to d...@suckless.org, Roberto E. Vargas Caballero
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
@@ -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


Reply all
Reply to author
Forward
0 new messages