[PATCH 1/3] perf daemon: Check err before calling setup_server_config in __cmd_start

From: Yang Jihong
Date: Sat Oct 22 2022 - 06:35:25 EST


If err!=0 before calling setup_server_config and reconfig==true,
setup_server_config function may return 0 and err becomes 0.
As a result, previous error is overwritten, need to check value of err first.

Signed-off-by: Yang Jihong <yangjihong1@xxxxxxxxxx>
---
tools/perf/builtin-daemon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-daemon.c b/tools/perf/builtin-daemon.c
index 6cb3f6cc36d0..b82bd902602a 100644
--- a/tools/perf/builtin-daemon.c
+++ b/tools/perf/builtin-daemon.c
@@ -1333,7 +1333,7 @@ static int __cmd_start(struct daemon *daemon, struct option parent_options[],
if (fda.entries[signal_pos].revents & POLLIN)
err = handle_signalfd(daemon) < 0;

- if (reconfig)
+ if (!err && reconfig)
err = setup_server_config(daemon);
}
}
--
2.30.GIT