From 8a0c8575a72073755a580d859d17ce9e33597d18 Mon Sep 17 00:00:00 2001 From: WangFengTu Date: Sat, 8 May 2021 11:14:11 +0800 Subject: [PATCH] print error message if process workdir failed Signed-off-by: WangFengTu --- ...or-message-if-process-workdir-failed.patch | 32 +++++++++++++++++++ lxc.spec | 9 +++++- series.conf | 1 + 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 0022-print-error-message-if-process-workdir-failed.patch diff --git a/0022-print-error-message-if-process-workdir-failed.patch b/0022-print-error-message-if-process-workdir-failed.patch new file mode 100644 index 0000000..8b75967 --- /dev/null +++ b/0022-print-error-message-if-process-workdir-failed.patch @@ -0,0 +1,32 @@ +From 540981ef79b921fea26e24456fbecc648eaf6e9e Mon Sep 17 00:00:00 2001 +From: WangFengTu +Date: Sat, 8 May 2021 11:02:08 +0800 +Subject: [PATCH] print error message if process workdir failed + +Signed-off-by: WangFengTu +--- + src/lxc/attach.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/lxc/attach.c b/src/lxc/attach.c +index 2ed2329..68f4148 100644 +--- a/src/lxc/attach.c ++++ b/src/lxc/attach.c +@@ -798,10 +798,14 @@ static int attach_child_main(struct attach_clone_payload *payload) + struct stat st; + if (stat(init_cwd, &st) < 0 && mkdir_p(init_cwd, 0750) < 0) { + SYSERROR("Try to create directory \"%s\" as workdir failed when attach", init_cwd); ++ lxc_write_error_message(msg_fd, "Try to create directory \"%s\" as workdir failed when attach: %s", ++ init_cwd, strerror(errno)); + goto on_error; + } + if (chdir(init_cwd)) { + SYSERROR("Could not change directory to \"%s\" when attach", init_cwd); ++ lxc_write_error_message(msg_fd, "Could not change directory to \"%s\" when attach: %s", ++ init_cwd, strerror(errno)); + goto on_error; + } + } +-- +2.25.1 + diff --git a/lxc.spec b/lxc.spec index 08ca4d6..25279c2 100644 --- a/lxc.spec +++ b/lxc.spec @@ -1,4 +1,4 @@ -%global _release 2021040701 +%global _release 2021050801 Name: lxc Version: 4.0.3 @@ -29,6 +29,7 @@ Patch0018: 0018-IO-fix-io-data-miss-when-exec-with-pipes.patch Patch0019: 0019-metrics-add-total_inactive_file-metric-for-memory.patch Patch0020: 0020-support-cgroup-v2.patch Patch0021: 0021-support-isula-exec-workdir.patch +Patch0022: 0022-print-error-message-if-process-workdir-failed.patch BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath BuildRequires: pkgconfig(libseccomp) @@ -200,6 +201,12 @@ make check %{_mandir}/*/man7/%{name}* %changelog +* Sat Mar 08 2021 wangfengtu - 4.0.3-2021050801 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:print error message if process workdir failed + * Wed Apr 07 2021 wangfengtu - 4.0.3-2021040701 - Type:bugfix - ID:NA diff --git a/series.conf b/series.conf index 67507be..efe3aae 100644 --- a/series.conf +++ b/series.conf @@ -19,3 +19,4 @@ 0019-metrics-add-total_inactive_file-metric-for-memory.patch 0020-support-cgroup-v2.patch 0021-support-isula-exec-workdir.patch +0022-print-error-message-if-process-workdir-failed.patch -- Gitee