OSDN Git Service

We don't open a destination filehandle for symlinks, so xclose() would barf.
authorRob Landley <rob@landley.net>
Thu, 10 Apr 2008 03:24:36 +0000 (22:24 -0500)
committerRob Landley <rob@landley.net>
Thu, 10 Apr 2008 03:24:36 +0000 (22:24 -0500)
toys/cp.c

index 81a1e41..04c6369 100644 (file)
--- a/toys/cp.c
+++ b/toys/cp.c
@@ -87,6 +87,7 @@ void cp_file(char *src, char *dst, struct stat *srcst)
                // filehandle to them?  O_NOFOLLOW causes the open to fail.
                if (!link || symlink(link, dst)) perror_msg("link '%s'", dst);
                free(link);
+               return;
        } else if (toys.optflags & FLAG_l) {
                if (link(src, dst)) perror_msg("link '%s'");
                return;