dpu-utilities/0018-fix-return-exit-status-bug-in-rexec.patch
liqiang d57469f9b2 update recently bugfix
Signed-off-by: liqiang <liqiang64@huawei.com>
2023-12-26 15:47:21 +08:00

67 lines
2.0 KiB
Diff

From a3f2eaf718eebb05d4b2d350833e1416d1c4a2f6 Mon Sep 17 00:00:00 2001
From: liqiang <liqiang64@huawei.com>
Date: Tue, 19 Dec 2023 20:06:07 +0800
Subject: [PATCH 5/6] fix return exit status bug in rexec
Signed-off-by: liqiang <liqiang64@huawei.com>
---
qtfs/rexec/rexec.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/qtfs/rexec/rexec.c b/qtfs/rexec/rexec.c
index f905cfa..eb8b9bd 100644
--- a/qtfs/rexec/rexec.c
+++ b/qtfs/rexec/rexec.c
@@ -51,6 +51,7 @@ struct rexec_thread_arg {
int efd;
int connfd;
char **argv;
+ int exit_status;
};
struct rexec_global_var g_rexec;
@@ -311,7 +312,7 @@ static int rexec_run(int efd, int connfd, char *argv[])
rexec_log("Rexec process start run, as proxy of remote %s", argv[1]);
rexec_event_run(efd);
- rexec_log("Rexec process %s exit.", argv[1]);
+ rexec_log("Rexec process %s exit status:%d.", argv[1], exit_status);
// clear pidmap file
if (pidfd > 0) {
@@ -687,9 +688,9 @@ static void *rexec_pipe_proxy_thread(void *arg)
static void *rexec_conn_thread(void *arg)
{
struct rexec_thread_arg *parg = (struct rexec_thread_arg *)arg;
- int exit_status = rexec_run(parg->efd, parg->connfd, parg->argv);
+ parg->exit_status = rexec_run(parg->efd, parg->connfd, parg->argv);
- pthread_exit((void *)&exit_status);
+ pthread_exit((void *)NULL);
}
static void rexec_global_var_init()
@@ -757,7 +758,6 @@ int main(int argc, char *argv[])
pthread_t thrd_conn;
struct rexec_thread_arg targ;
struct rexec_thread_arg connarg;
- void *exit_status;
targ.efd = pipeefd;
(void)pthread_create(&thrd, NULL, rexec_pipe_proxy_thread, &targ);
@@ -765,9 +765,9 @@ int main(int argc, char *argv[])
connarg.connfd = connfd;
connarg.argv = argv;
(void)pthread_create(&thrd_conn, NULL, rexec_conn_thread, &connarg);
- pthread_join(thrd_conn, (void **)&exit_status);
+ pthread_join(thrd_conn, NULL);
fclose(rexec_logfile);
- exit(*(int *)exit_status);
+ exit(connarg.exit_status);
err_end:
fclose(rexec_logfile);
rexec_logfile = NULL;
--
2.37.1 (Apple Git-137.1)