comparison dbmulti.c @ 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 0dcc5b0d93fa
children
comparison
equal deleted inserted replaced
1871:b89cf71ec40c 1872:6b25cdad4783
60 } 60 }
61 61
62 int main(int argc, char ** argv) { 62 int main(int argc, char ** argv) {
63 int i; 63 int i;
64 for (i = 0; i < 2; i++) { 64 for (i = 0; i < 2; i++) {
65 const char* multipath = NULL;
66 if (i == 1) {
67 multipath = argv[0];
68 }
65 /* Try symlink first, then try as an argument eg "dropbearmulti dbclient host ..." */ 69 /* Try symlink first, then try as an argument eg "dropbearmulti dbclient host ..." */
66 if (argc > i) { 70 if (argc > i) {
67 int match, res; 71 int match, res;
68 /* figure which form we're being called as */ 72 /* figure which form we're being called as */
69 const char* progname = basename(argv[i]); 73 const char* progname = basename(argv[i]);
70 res = runprog(argv[0], progname, argc-i, &argv[i], &match); 74 res = runprog(multipath, progname, argc-i, &argv[i], &match);
71 if (match == DROPBEAR_SUCCESS) { 75 if (match == DROPBEAR_SUCCESS) {
72 return res; 76 return res;
73 } 77 }
74 } 78 }
75 } 79 }