print error message if process workdir failed

Signed-off-by: WangFengTu <wangfengtu@huawei.com>
This commit is contained in:
WangFengTu 2021-05-08 11:14:11 +08:00
parent e915fbd36b
commit 8a0c8575a7
3 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,32 @@
From 540981ef79b921fea26e24456fbecc648eaf6e9e Mon Sep 17 00:00:00 2001
From: WangFengTu <wangfengtu@huawei.com>
Date: Sat, 8 May 2021 11:02:08 +0800
Subject: [PATCH] print error message if process workdir failed
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
---
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

View File

@ -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 <wangfengtu@huawei.com> - 4.0.3-2021050801
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:print error message if process workdir failed
* Wed Apr 07 2021 wangfengtu <wangfengtu@huawei.com> - 4.0.3-2021040701
- Type:bugfix
- ID:NA

View File

@ -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