aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 98bd4fe72..2d6557cd4 100644
--- a/libbb/copy_file.c
+++ b/libbb/copy_file.c
@@ -388,14 +388,15 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags)
388 char *lpath = xmalloc_readlink_or_warn(source); 388 char *lpath = xmalloc_readlink_or_warn(source);
389 if (lpath) { 389 if (lpath) {
390 int r = symlink(lpath, dest); 390 int r = symlink(lpath, dest);
391 free(lpath);
392 if (r < 0) { 391 if (r < 0) {
393 /* shared message */ 392 /* shared message */
394 bb_perror_msg("can't create %slink '%s' to '%s'", 393 bb_perror_msg("can't create %slink '%s' to '%s'",
395 "sym", dest, lpath 394 "sym", dest, lpath
396 ); 395 );
396 free(lpath);
397 return -1; 397 return -1;
398 } 398 }
399 free(lpath);
399 if (flags & FILEUTILS_PRESERVE_STATUS) 400 if (flags & FILEUTILS_PRESERVE_STATUS)
400 if (lchown(dest, source_stat.st_uid, source_stat.st_gid) < 0) 401 if (lchown(dest, source_stat.st_uid, source_stat.st_gid) < 0)
401 bb_perror_msg("can't preserve %s of '%s'", "ownership", dest); 402 bb_perror_msg("can't preserve %s of '%s'", "ownership", dest);