ash: builtin: Mark more regular built-ins
[oweals/busybox.git] / libbb / copy_file.c
index 98bd4fe72cadfa55460a3af4f1ed095872b05e6c..49d1ec9c61d50ce62720e435643e7f3ceb1960c2 100644 (file)
@@ -327,7 +327,7 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags)
                ) {
                        security_context_t con;
                        if (getfscreatecon(&con) == -1) {
-                               bb_perror_msg("getfscreatecon");
+                               bb_simple_perror_msg("getfscreatecon");
                                return -1;
                        }
                        if (con) {
@@ -388,14 +388,15 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags)
                char *lpath = xmalloc_readlink_or_warn(source);
                if (lpath) {
                        int r = symlink(lpath, dest);
-                       free(lpath);
                        if (r < 0) {
                                /* shared message */
                                bb_perror_msg("can't create %slink '%s' to '%s'",
                                        "sym", dest, lpath
                                );
+                               free(lpath);
                                return -1;
                        }
+                       free(lpath);
                        if (flags & FILEUTILS_PRESERVE_STATUS)
                                if (lchown(dest, source_stat.st_uid, source_stat.st_gid) < 0)
                                        bb_perror_msg("can't preserve %s of '%s'", "ownership", dest);