From 89ea3b1d6e9a45b3944e364034b4b698555a438a Mon Sep 17 00:00:00 2001 From: Andrea Righi Date: Thu, 23 Jan 2025 17:10:52 +0100 Subject: [PATCH] virtme-ng-init: always check return code when executing bash Fix the following warning: warning: unused return value of `exec` that must be used --> src/main.rs:978:13 | 978 | Command::new("bash").arg("-l").exec(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_must_use)]` on by default Moreover, check the return code in case exec() fails and log an explicit error before exiting. Signed-off-by: Andrea Righi --- virtme_ng_init/src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/virtme_ng_init/src/main.rs b/virtme_ng_init/src/main.rs index 85f990b..515f4ae 100644 --- a/virtme_ng_init/src/main.rs +++ b/virtme_ng_init/src/main.rs @@ -975,7 +975,8 @@ fn setup_user_session() { Some(console) => console, None => { log!("failed to determine console"); - Command::new("bash").arg("-l").exec(); + let err = Command::new("bash").arg("-l").exec(); + log!("failed to exec bash: {}", err); return; } };