diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2008-12-17 14:23:43 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2008-12-17 14:23:43 -0500 |
commit | 3f23f712477df48fd1d57376b65c44bb2a19ec16 (patch) | |
tree | e970483505d900d8b5aa597faff78569d7359b09 /utils | |
parent | b5009d23525181846777349f2fc0e4a72b89d24d (diff) | |
download | nfs-utils-3f23f712477df48fd1d57376b65c44bb2a19ec16.tar.gz nfs-utils-3f23f712477df48fd1d57376b65c44bb2a19ec16.tar.xz nfs-utils-3f23f712477df48fd1d57376b65c44bb2a19ec16.zip |
text-based mount command: use po_get_numeric() for handling retry
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>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/mount/stropts.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 09fca86..43791e6 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -99,19 +99,21 @@ struct nfsmount_info { static time_t nfs_parse_retry_option(struct mount_options *options, unsigned int timeout_minutes) { - char *retry_option, *endptr; + long tmp; - 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) { timeout_minutes = tmp; - else if (verbose) + break; + } + case PO_BAD_VALUE: + if (verbose) nfs_error(_("%s: invalid retry timeout was specified; " "using default timeout"), progname); + break; } return time(NULL) + (time_t)(timeout_minutes * 60); |