Replace the logic in nfs_parse_retry_option() with a call to the new
po_get_numeric() function.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
static time_t nfs_parse_retry_option(struct mount_options *options,
unsigned int timeout_minutes)
{
static time_t nfs_parse_retry_option(struct mount_options *options,
unsigned int timeout_minutes)
{
- char *retry_option, *endptr;
- retry_option = po_get(options, "retry");
- if (retry_option) {
- long tmp;
-
- errno = 0;
- tmp = strtol(retry_option, &endptr, 10);
- if (errno == 0 && endptr != retry_option && tmp >= 0)
+ switch (po_get_numeric(options, "retry", &tmp)) {
+ case PO_NOT_FOUND:
+ break;
+ case PO_FOUND:
+ if (tmp >= 0) {
+ break;
+ }
+ case PO_BAD_VALUE:
+ if (verbose)
nfs_error(_("%s: invalid retry timeout was specified; "
"using default timeout"), progname);
nfs_error(_("%s: invalid retry timeout was specified; "
"using default timeout"), progname);
}
return time(NULL) + (time_t)(timeout_minutes * 60);
}
return time(NULL) + (time_t)(timeout_minutes * 60);