aboutsummaryrefslogtreecommitdiff
path: root/libbb/copy_file.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-09-10 14:37:07 +0100
committerRon Yorston <rmy@pobox.com>2018-09-10 14:59:33 +0100
commitd89ced75b204f0eb5611f522864beb81d1b393f5 (patch)
tree5daa31427e287fe079a0ef551097753773fdb266 /libbb/copy_file.c
parentf72845d9332fa6311a46dbcad3180d5008182982 (diff)
parent05b18065ab9c375f6185b65a3631d4c6cc1a4be9 (diff)
downloadbusybox-w32-d89ced75b204f0eb5611f522864beb81d1b393f5.tar.gz
busybox-w32-d89ced75b204f0eb5611f522864beb81d1b393f5.tar.bz2
busybox-w32-d89ced75b204f0eb5611f522864beb81d1b393f5.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'libbb/copy_file.c')
-rw-r--r--libbb/copy_file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libbb/copy_file.c b/libbb/copy_file.c
index 7cd9cd978..299cd7bea 100644
--- a/libbb/copy_file.c
+++ b/libbb/copy_file.c
@@ -391,14 +391,15 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags)
391 char *lpath = xmalloc_readlink_or_warn(source); 391 char *lpath = xmalloc_readlink_or_warn(source);
392 if (lpath) { 392 if (lpath) {
393 int r = symlink(lpath, dest); 393 int r = symlink(lpath, dest);
394 free(lpath);
395 if (r < 0) { 394 if (r < 0) {
396 /* shared message */ 395 /* shared message */
397 bb_perror_msg("can't create %slink '%s' to '%s'", 396 bb_perror_msg("can't create %slink '%s' to '%s'",
398 "sym", dest, lpath 397 "sym", dest, lpath
399 ); 398 );
399 free(lpath);
400 return -1; 400 return -1;
401 } 401 }
402 free(lpath);
402 if (flags & FILEUTILS_PRESERVE_STATUS) 403 if (flags & FILEUTILS_PRESERVE_STATUS)
403 if (lchown(dest, source_stat.st_uid, source_stat.st_gid) < 0) 404 if (lchown(dest, source_stat.st_uid, source_stat.st_gid) < 0)
404 bb_perror_msg("can't preserve %s of '%s'", "ownership", dest); 405 bb_perror_msg("can't preserve %s of '%s'", "ownership", dest);