From 142bfc867110de7a93e3caddd9a89f8958115df7 Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Tue, 8 Feb 2022 12:13:34 +0100 Subject: [PATCH] nvme: Fix --force flag inversion argparse sets the default_value member when the argument has been provided by the user. But in parse_and_open we set O_EXCL when --force is not used. It also introduced a regression in the 'id-ns' where the --force flag is used to determine which function is used to identify the namespace (nvme_identify_allocated_ns() vs nvme_identify_ns()). Fixes: 2100609 ("nvme: open namespace exclusive by default") Signed-off-by: Daniel Wagner --- nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvme.c b/nvme.c index 40bd4c94..73052a12 100644 --- a/nvme.c +++ b/nvme.c @@ -277,7 +277,7 @@ int parse_and_open(int argc, char **argv, const char *desc, for (s = opts; s && s->option; s++) { if (!strcmp(s->option, "force")) { - if (! *(int *)s->default_value) + if (*(int *)s->default_value) flags |= O_EXCL; break; } -- 2.50.1