changeset 1872:6b25cdad4783

Fix regression in non-symlink dropbearmulti Introduced in recent commit for re-exec
author Matt Johnston <matt@ucc.asn.au>
date Tue, 01 Feb 2022 23:15:53 +0800
parents b89cf71ec40c
children 2c9d635a1c04
files dbmulti.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dbmulti.c	Tue Feb 01 22:25:51 2022 +0800
+++ b/dbmulti.c	Tue Feb 01 23:15:53 2022 +0800
@@ -62,12 +62,16 @@
 int main(int argc, char ** argv) {
 	int i;
 	for (i = 0; i < 2; i++) {
+		const char* multipath = NULL;
+		if (i == 1) {
+			multipath = argv[0];
+		}
 		/* Try symlink first, then try as an argument eg "dropbearmulti dbclient host ..." */
 		if (argc > i) {
 			int match, res;
 			/* figure which form we're being called as */
 			const char* progname = basename(argv[i]);
-			res = runprog(argv[0], progname, argc-i, &argv[i], &match);
+			res = runprog(multipath, progname, argc-i, &argv[i], &match);
 			if (match == DROPBEAR_SUCCESS) {
 				return res;
 			}