[hackers] [ubase][PATCH] fix off-by-one bug in switch_root which can confuse inits

From: Daniel Wilkins <tekk.tonic_AT_aol.com>
Date: Sat, 15 Apr 2023 00:33:34 -0400

---
 switch_root.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/switch_root.c b/switch_root.c
index 204f7d1..9fc61e0 100644
--- a/switch_root.c
+++ b/switch_root.c
_AT_@ -123,9 +123,9 @@ main(int argc, char *argv[])
 		dup2(0, 1);
 		dup2(0, 2);
 	}
-
+	argv++;
 	/* execute init */
-	execv(argv[1], argv);
-	eprintf("can't execute '%s':", argv[1]);
+	execv(argv[0], argv);
+	eprintf("can't execute '%s':", argv[0]);
 	return 1;
 }
-- 
2.35.7
Received on Sat Apr 15 2023 - 06:33:34 CEST

This archive was generated by hypermail 2.3.0 : Sat Apr 15 2023 - 08:00:41 CEST