[2/3,v2] service: call kerndat_init() before feature check

Submitted by Andrei Vagin on Oct. 15, 2018, 4:33 a.m.

Details

Message ID 20181015043359.2908-2-avagin@gmail.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Andrei Vagin Oct. 15, 2018, 4:33 a.m.
setup_opts_from_req() sets up logging and call kerndat_init().

Investigated-by: Adrian Reber <areber@redhat.com>
Fixes: 6e04f3b2dd06 ("criu: call kerndat_init() after log_init()")
Signed-off-by: Andrei Vagin <avagin@gmail.com>
---

v2: exit from a child process if setup_opts_from_req fails

 criu/cr-service.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/criu/cr-service.c b/criu/cr-service.c
index af9ccddd2..22ed7b503 100644
--- a/criu/cr-service.c
+++ b/criu/cr-service.c
@@ -971,6 +971,9 @@  static int handle_feature_check(int sk, CriuReq * msg)
 	}
 
 	if (pid == 0) {
+		/* kerndat_init() is called from setup_opts_from_req() */
+		if (setup_opts_from_req(sk, msg->opts))
+			exit(1);
 
 		setproctitle("feature-check --rpc");
 
@@ -994,7 +997,7 @@  static int handle_feature_check(int sk, CriuReq * msg)
 		 * be send from the parent process.
 		 */
 		ret = send_criu_msg(sk, &resp);
-		exit(ret);
+		exit(!!ret);
 	}
 	if (waitpid(pid, &status, 0) != pid) {
 		pr_perror("Unable to wait %d", pid);

Comments

Radostin Stoyanov Oct. 15, 2018, 7:46 a.m.
On 15/10/2018 05:33, Andrei Vagin wrote:
> -		exit(ret);
> +		exit(!!ret);
Is the double logical negation here on purpose or just a typo?

Radostin
Radostin Stoyanov Oct. 15, 2018, 7:51 a.m.
On 15/10/2018 08:46, Radostin Stoyanov wrote:
> On 15/10/2018 05:33, Andrei Vagin wrote:
>> -		exit(ret);
>> +		exit(!!ret);
> Is the double logical negation here on purpose or just a typo?
Never mind. I found the answer in https://stackoverflow.com/a/248698
> Radostin