!25 attach: add err msg when call attach failed
Merge pull request !25 from lifeng_isula/fix_mastetr
This commit is contained in:
commit
f50c80e3f6
49
0060-attach-append-error-msg-when-call-attach-failed.patch
Normal file
49
0060-attach-append-error-msg-when-call-attach-failed.patch
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
From de512a0c11bff1bfc8f0045e144bddc689742a21 Mon Sep 17 00:00:00 2001
|
||||||
|
From: LiFeng <lifeng68@huawei.com>
|
||||||
|
Date: Thu, 30 Apr 2020 16:40:14 +0800
|
||||||
|
Subject: [PATCH] attach: append error msg when call attach failed
|
||||||
|
|
||||||
|
Signed-off-by: LiFeng <lifeng68@huawei.com>
|
||||||
|
---
|
||||||
|
src/lxc/tools/lxc_attach.c | 13 ++++++++++---
|
||||||
|
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/lxc/tools/lxc_attach.c b/src/lxc/tools/lxc_attach.c
|
||||||
|
index 190f3c8..dbddc2a 100644
|
||||||
|
--- a/src/lxc/tools/lxc_attach.c
|
||||||
|
+++ b/src/lxc/tools/lxc_attach.c
|
||||||
|
@@ -401,12 +401,17 @@ static int do_attach_foreground(struct lxc_container *c, lxc_attach_command_t *c
|
||||||
|
ret = c->attach(c, lxc_attach_run_command, command, attach_options, &pid);
|
||||||
|
else
|
||||||
|
ret = c->attach(c, lxc_attach_run_shell, NULL, attach_options, &pid);
|
||||||
|
- if (ret < 0)
|
||||||
|
+ if (ret < 0) {
|
||||||
|
+ *errmsg = safe_strdup("Internal error, failed to call attach");
|
||||||
|
goto out;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
ret = lxc_wait_for_pid_status(pid);
|
||||||
|
- if (ret < 0)
|
||||||
|
+ if (ret < 0) {
|
||||||
|
+ free(*errmsg);
|
||||||
|
+ *errmsg = safe_strdup("Internal error, failed to wait attached process");
|
||||||
|
goto out;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (WIFEXITED(ret))
|
||||||
|
wexit = WEXITSTATUS(ret);
|
||||||
|
@@ -421,8 +426,10 @@ static int do_attach_foreground(struct lxc_container *c, lxc_attach_command_t *c
|
||||||
|
ERROR("Execd pid %d exit with %d", pid, wexit);
|
||||||
|
|
||||||
|
out:
|
||||||
|
- if (c->lxc_conf->errmsg)
|
||||||
|
+ if (c->lxc_conf->errmsg) {
|
||||||
|
+ free(*errmsg);
|
||||||
|
*errmsg = safe_strdup(c->lxc_conf->errmsg);
|
||||||
|
+ }
|
||||||
|
return wexit;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
3
lxc.spec
3
lxc.spec
@ -1,4 +1,4 @@
|
|||||||
%global _release 2020042801
|
%global _release 2020043001
|
||||||
%global debug_package %{nil}
|
%global debug_package %{nil}
|
||||||
|
|
||||||
Name: lxc
|
Name: lxc
|
||||||
@ -67,6 +67,7 @@ Patch9055: 0056-attach-add-sigfd-to-monitor-the-exit-of-pid.patch
|
|||||||
Patch9056: 0057-attach-add-read-data-from-attach-sigfd.patch
|
Patch9056: 0057-attach-add-read-data-from-attach-sigfd.patch
|
||||||
Patch9057: 0058-support-syslog-for-console.patch
|
Patch9057: 0058-support-syslog-for-console.patch
|
||||||
Patch9058: 0059-set-state-to-stopped.patch
|
Patch9058: 0059-set-state-to-stopped.patch
|
||||||
|
Patch9059: 0060-attach-append-error-msg-when-call-attach-failed.patch
|
||||||
|
|
||||||
BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath
|
BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath
|
||||||
BuildRequires: pkgconfig(libseccomp)
|
BuildRequires: pkgconfig(libseccomp)
|
||||||
|
|||||||
@ -57,3 +57,4 @@
|
|||||||
0057-attach-add-read-data-from-attach-sigfd.patch
|
0057-attach-add-read-data-from-attach-sigfd.patch
|
||||||
0058-support-syslog-for-console.patch
|
0058-support-syslog-for-console.patch
|
||||||
0059-set-state-to-stopped.patch
|
0059-set-state-to-stopped.patch
|
||||||
|
0060-attach-append-error-msg-when-call-attach-failed.patch
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user