If user input in a last sector dialog was out of range and with suffix, and if
this was followed by accepting the default value, then the used last sector was
erroneously default - 1.
Reported-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
{
unsigned int res;
int default_ok = 1;
+ int absolute = 0;
static char *ms = NULL;
static size_t mslen = 0;
if (*line_ptr == '+' || *line_ptr == '-') {
int minus = (*line_ptr == '-');
- int absolute = 0;
int suflen;
+ absolute = 0;
res = atoi(line_ptr + 1);
while (isdigit(*++line_ptr))
bytes += unit/2; /* round */
bytes /= unit;
res = bytes;
- if (is_suffix_used)
- *is_suffix_used = absolute;
}
if (minus)
res = -res;
use_default = 0;
}
}
- if (use_default)
- printf(_("Using default value %u\n"), res = dflt);
+ if (use_default) {
+ printf(_("Using default value %u\n"), dflt);
+ return dflt;
+ }
if (res >= low && res <= high)
break;
else
printf(_("Value out of range.\n"));
}
+ if (is_suffix_used)
+ *is_suffix_used = absolute > 0;
return res;
}