summaryrefslogtreecommitdiffstats
path: root/test/use_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/use_common.c')
-rw-r--r--test/use_common.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/use_common.c b/test/use_common.c
index 908cac9..5aa6692 100644
--- a/test/use_common.c
+++ b/test/use_common.c
@@ -48,6 +48,8 @@ parse_option(int argc, char * const argv[])
{
int ret_value=0;
int c;
+ int use_swmr; /* Need an int to detect errors */
+
/* command line options: See function usage for a description */
const char *nagg_options = "f:hi:l:n:s:y:z:";
@@ -96,11 +98,13 @@ parse_option(int argc, char * const argv[])
};
break;
case 's': /* use swmr file open mode */
- if ((UC_opts.use_swmr = HDatoi(optarg)) < 0) {
- fprintf(stderr, "swmr value should be 0(no) or 1(yes)\n");
- usage(progname_g);
- Hgoto_error(-1);
- };
+ use_swmr = HDatoi(optarg);
+ if (use_swmr != 0 && use_swmr != 1) {
+ HDfprintf(stderr, "swmr value should be 0(no) or 1(yes)\n");
+ usage(progname_g);
+ Hgoto_error(-1);
+ }
+ UC_opts.use_swmr = (hbool_t)use_swmr;
break;
case 'y': /* Number of planes per chunk */
if ((UC_opts.chunkplanes = HDstrtoul(optarg, NULL, 0)) <= 0) {