diff --git a/app/iscsi_tgt/iscsi_tgt.c b/app/iscsi_tgt/iscsi_tgt.c index 40c3e115a..1a8a662f4 100644 --- a/app/iscsi_tgt/iscsi_tgt.c +++ b/app/iscsi_tgt/iscsi_tgt.c @@ -175,8 +175,6 @@ main(int argc, char **argv) sleep(10); } - optind = 1; /* reset the optind */ - opts.shutdown_cb = spdk_iscsi_shutdown; opts.usr1_handler = spdk_sigusr1; spdk_app_init(&opts); diff --git a/examples/ioat/perf/perf.c b/examples/ioat/perf/perf.c index bee9bbc04..3d4902527 100644 --- a/examples/ioat/perf/perf.c +++ b/examples/ioat/perf/perf.c @@ -298,7 +298,7 @@ parse_args(int argc, char **argv) usage(argv[0]); return 1; } - optind = 1; + return 0; } diff --git a/examples/ioat/verify/verify.c b/examples/ioat/verify/verify.c index 645327d72..792551495 100644 --- a/examples/ioat/verify/verify.c +++ b/examples/ioat/verify/verify.c @@ -275,7 +275,7 @@ parse_args(int argc, char **argv) usage(argv[0]); return 1; } - optind = 1; + return 0; } diff --git a/examples/nvme/hotplug/hotplug.c b/examples/nvme/hotplug/hotplug.c index 78580b875..05943febe 100644 --- a/examples/nvme/hotplug/hotplug.c +++ b/examples/nvme/hotplug/hotplug.c @@ -409,7 +409,6 @@ parse_args(int argc, char **argv) return 1; } - optind = 1; return 0; } diff --git a/examples/nvme/identify/identify.c b/examples/nvme/identify/identify.c index e07baba80..3aea5967c 100644 --- a/examples/nvme/identify/identify.c +++ b/examples/nvme/identify/identify.c @@ -960,8 +960,6 @@ parse_args(int argc, char **argv) } } - optind = 1; - return 0; } diff --git a/examples/nvme/perf/perf.c b/examples/nvme/perf/perf.c index 91e2e2104..f0bc8e828 100644 --- a/examples/nvme/perf/perf.c +++ b/examples/nvme/perf/perf.c @@ -1179,7 +1179,7 @@ parse_args(int argc, char **argv) } g_aio_optind = optind; - optind = 1; + return 0; } diff --git a/lib/env_dpdk/init.c b/lib/env_dpdk/init.c index 05230b089..160dc5098 100644 --- a/lib/env_dpdk/init.c +++ b/lib/env_dpdk/init.c @@ -236,6 +236,7 @@ void spdk_env_init(const struct spdk_env_opts *opts) char **args = NULL; char **dpdk_args = NULL; int argcount, i, rc; + int orig_optind; argcount = spdk_build_eal_cmdline(opts, &args); if (argcount <= 0) { @@ -262,7 +263,10 @@ void spdk_env_init(const struct spdk_env_opts *opts) memcpy(dpdk_args, args, sizeof(char *) * argcount); fflush(stdout); + orig_optind = optind; + optind = 1; rc = rte_eal_init(argcount, dpdk_args); + optind = orig_optind; spdk_free_args(args, argcount); free(dpdk_args); diff --git a/test/app/stub/stub.c b/test/app/stub/stub.c index 2a4d4a7c1..2a2bac840 100644 --- a/test/app/stub/stub.c +++ b/test/app/stub/stub.c @@ -105,8 +105,6 @@ main(int argc, char **argv) exit(1); } - optind = 1; /* reset the optind */ - spdk_env_init(&opts); if (spdk_nvme_probe(NULL, NULL, probe_cb, attach_cb, NULL) != 0) { fprintf(stderr, "spdk_nvme_probe() failed\n"); diff --git a/test/lib/bdev/bdevperf/bdevperf.c b/test/lib/bdev/bdevperf/bdevperf.c index c95131e62..d52a2a3aa 100644 --- a/test/lib/bdev/bdevperf/bdevperf.c +++ b/test/lib/bdev/bdevperf/bdevperf.c @@ -714,8 +714,6 @@ main(int argc, char **argv) g_zcopy = false; } - optind = 1; /* reset the optind */ - blockdev_heads_init(); bdevtest_init(config_file, core_mask); diff --git a/test/lib/event/event_perf/event_perf.c b/test/lib/event/event_perf/event_perf.c index e3bf65022..f9338591a 100644 --- a/test/lib/event/event_perf/event_perf.c +++ b/test/lib/event/event_perf/event_perf.c @@ -143,8 +143,6 @@ main(int argc, char **argv) exit(1); } - optind = 1; /* reset the optind */ - spdk_app_init(&opts); g_tsc_rate = spdk_get_ticks_hz(); diff --git a/test/lib/event/reactor/reactor.c b/test/lib/event/reactor/reactor.c index 3a262ccb0..784cf27ff 100644 --- a/test/lib/event/reactor/reactor.c +++ b/test/lib/event/reactor/reactor.c @@ -134,8 +134,6 @@ main(int argc, char **argv) exit(1); } - optind = 1; - opts.shutdown_cb = test_cleanup; spdk_app_init(&opts); diff --git a/test/lib/event/reactor_perf/reactor_perf.c b/test/lib/event/reactor_perf/reactor_perf.c index 5b287a3ac..d7712a14d 100644 --- a/test/lib/event/reactor_perf/reactor_perf.c +++ b/test/lib/event/reactor_perf/reactor_perf.c @@ -130,8 +130,6 @@ main(int argc, char **argv) exit(1); } - optind = 1; - opts.shutdown_cb = test_cleanup; spdk_app_init(&opts); diff --git a/test/lib/nvme/aer/aer.c b/test/lib/nvme/aer/aer.c index 3373e3d09..e748767f2 100644 --- a/test/lib/nvme/aer/aer.c +++ b/test/lib/nvme/aer/aer.c @@ -240,8 +240,6 @@ parse_args(int argc, char **argv) } } - optind = 1; - return 0; } diff --git a/test/lib/nvme/overhead/overhead.c b/test/lib/nvme/overhead/overhead.c index 7b5e4ea9f..c5a84c0e8 100644 --- a/test/lib/nvme/overhead/overhead.c +++ b/test/lib/nvme/overhead/overhead.c @@ -514,7 +514,7 @@ parse_args(int argc, char **argv) } g_aio_optind = optind; - optind = 1; + return 0; } diff --git a/test/lib/nvme/reset/reset.c b/test/lib/nvme/reset/reset.c index a0bd28ff3..998f38c24 100644 --- a/test/lib/nvme/reset/reset.c +++ b/test/lib/nvme/reset/reset.c @@ -485,7 +485,6 @@ parse_args(int argc, char **argv) g_is_random = 1; } - optind = 1; return 0; }