aboutsummaryrefslogtreecommitdiff
path: root/toys/cp.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2008-04-09 22:24:36 -0500
committerRob Landley <rob@landley.net>2008-04-09 22:24:36 -0500
commitf639c65ac49b97fdf2445f6ba79da66eb986e925 (patch)
tree29231fa0139b07b208c5ad64325a711e51f88bff /toys/cp.c
parentdd4d83e58135c7f75f5cf0103cd4c6ced4e86c84 (diff)
downloadtoybox-f639c65ac49b97fdf2445f6ba79da66eb986e925.tar.gz
We don't open a destination filehandle for symlinks, so xclose() would barf.
Diffstat (limited to 'toys/cp.c')
-rw-r--r--toys/cp.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/toys/cp.c b/toys/cp.c
index 81a1e418..04c6369b 100644
--- 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;