[hackers] [sbase] Only unlink the destination file if -f has been specified || sin

From: <git_AT_suckless.org>
Date: Mon, 17 Nov 2014 13:33:25 +0100

commit a6be4e7a4c6072c1597ad9483e5eb180c57d2c80
Author: sin <sin_AT_2f30.org>
Date: Mon Nov 17 12:33:08 2014 +0000

    Only unlink the destination file if -f has been specified

diff --git a/util/cp.c b/util/cp.c
index a5c3816..948337f 100644
--- a/util/cp.c
+++ b/util/cp.c
_AT_@ -47,7 +47,7 @@ cp(const char *s1, const char *s2)
         if (r == 0) {
                 if (cp_dflag && S_ISLNK(st.st_mode)) {
                         if (readlink(s1, buf, sizeof(buf) - 1) >= 0) {
- if (cp_fflag);
+ if (cp_fflag)
                                         unlink(s2);
                                 if (symlink(buf, s2) != 0) {
                                         weprintf("%s: can't create '%s'\n", argv0, s2);
Received on Mon Nov 17 2014 - 13:33:25 CET

This archive was generated by hypermail 2.3.0 : Mon Nov 17 2014 - 13:36:10 CET