In case we want to process an inittab item multiple times (e.g. in case
of hotplugging) we must not shift the arguments for askfirst multiple
times. So check whether we already did it.
Signed-off-by: Michael Heimpold <mhei@heimpold.de>
}
a->tout.cb = respawn;
- for (i = MAX_ARGS - 1; i >= 1; i--)
- a->argv[i] = a->argv[i - 1];
- a->argv[0] = ask;
+ /* shift arguments only if not yet done */
+ if (a->argv[0] != ask) {
+ for (i = MAX_ARGS - 1; i >= 1; i--)
+ a->argv[i] = a->argv[i - 1];
+ a->argv[0] = ask;
+ }
a->respawn = 500;
a->proc.cb = child_exit;
}
a->tout.cb = respawn;
- for (i = MAX_ARGS - 1; i >= 1; i--)
- a->argv[i] = a->argv[i - 1];
- a->argv[0] = ask;
+ /* shift arguments only if not yet done */
+ if (a->argv[0] != ask) {
+ for (i = MAX_ARGS - 1; i >= 1; i--)
+ a->argv[i] = a->argv[i - 1];
+ a->argv[0] = ask;
+ }
a->respawn = 500;
a->proc.cb = child_exit;