cpio/backport-Do-not-set-exit-code-to-2-when-failing-to-create-sym.patch
chenziyang fa70b4abe1 backport CVE-2015-1197, delete revert-CVE-2015-1197.patch and backport the following 2 bugfix patches
(cherry picked from commit 8dd852fe405e8192412b00610379615897f740d6)
2023-08-30 11:51:21 +08:00

38 lines
1.3 KiB
Diff

From 388fbb65a2d7244717aaeac2b316b51ee0474dd4 Mon Sep 17 00:00:00 2001
From: Ziyang Chen <chenziyang4@huawei.com>
Date: Mon, 10 Jul 2023 20:19:27 +0800
Subject: [PATCH] Do not set exit code to 2 when failing to create symlink
Reference:https://lists.gnu.org/archive/html/bug-cpio/2023-07/msg00001.html
Conflict:NA
---
src/copyin.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/copyin.c b/src/copyin.c
index dc715ff..6fa5699 100644
--- a/src/copyin.c
+++ b/src/copyin.c
@@ -742,7 +742,7 @@ replace_symlink_placeholders (void)
res = UMASKED_SYMLINK (dl->source, dl->target, dl->mode);
}
if (res < 0)
- symlink_error (dl->source, dl->target);
+ error (0, errno, _("%s: Cannot create symlink to %s"), quotearg_colon (dl->target), quote_n (1, dl->source));
else if (!no_chown_flag)
{
uid_t uid = set_owner_flag ? set_owner : dl->uid;
@@ -795,7 +795,7 @@ copyin_link (struct cpio_file_stat *file_hdr, int in_file_des)
res = UMASKED_SYMLINK (link_name, file_hdr->c_name, file_hdr->c_mode);
}
if (res < 0)
- symlink_error (link_name, file_hdr->c_name);
+ error (0, errno, _("%s: Cannot create symlink to %s"), quotearg_colon (file_hdr->c_name), quote_n (1, link_name));
else if (!no_chown_flag)
{
uid_t uid = set_owner_flag ? set_owner : file_hdr->c_uid;
--
2.33.0