salvaged: Fix "-parallel all<number>" parsing

In salavageserver -parallel option takes "all<number>" argument.
However the code does not parse the numeric part correctly. Due
to this, only single instance of salvageserver process was running
even if we provide the larger number with "all" argument.

With this fix, numeric part of "all" argument will be parsed
correctly and will start required number of salvageserver instances.

Change-Id: Ib6318b1d57d04fecb84915e2dabe40930ea76499
Reviewed-on: https://gerrit.openafs.org/14201
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Kailas Zadbuke 2020-05-07 23:55:39 -04:00 committed by Benjamin Kaduk
parent 790824ff74
commit 4512d04a9b

View File

@ -211,11 +211,13 @@ handleit(struct cmd_syndesc *opts, void *arock)
cmd_OptionAsFlag(opts, OPT_salvagedirs, &RebuildDirs); cmd_OptionAsFlag(opts, OPT_salvagedirs, &RebuildDirs);
cmd_OptionAsFlag(opts, OPT_blockreads, &forceR); cmd_OptionAsFlag(opts, OPT_blockreads, &forceR);
if (cmd_OptionAsString(opts, OPT_parallel, &optstring) == 0) { if (cmd_OptionAsString(opts, OPT_parallel, &optstring) == 0) {
char *input = optstring;
if (strncmp(optstring, "all", 3) == 0) { if (strncmp(optstring, "all", 3) == 0) {
PartsPerDisk = 1; PartsPerDisk = 1;
input += 3;
} }
if (strlen(optstring) != 0) { if (strlen(input) != 0) {
Parallel = atoi(optstring); Parallel = atoi(input);
if (Parallel < 1) if (Parallel < 1)
Parallel = 1; Parallel = 1;
if (Parallel > MAXPARALLEL) { if (Parallel > MAXPARALLEL) {