All of lore.kernel.org
 help / color / mirror / Atom feed
* [ndctl PATCH v2 1/4] ndctl, inject-error: error out for a non-existent namespace
@ 2018-02-09  5:34 Vishal Verma
  2018-02-09  5:34 ` [ndctl PATCH v2 2/4] ndctl: add ndctl_encode_smart_temperature() Vishal Verma
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Vishal Verma @ 2018-02-09  5:34 UTC (permalink / raw)
  To: linux-nvdimm

When an invalid namespace was specified, inject-error would simply walk
through a loop trying to matching namespace, and at the end, exit out
silently. This could make it look as though the operation had been
successful, when in reality, nothing had been done.

Fix to print a message, and exit with an ENXIO when this happens.

Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 ndctl/inject-error.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ndctl/inject-error.c b/ndctl/inject-error.c
index 9b9d821..efa9f92 100644
--- a/ndctl/inject-error.c
+++ b/ndctl/inject-error.c
@@ -338,7 +338,8 @@ static int do_inject(const char *namespace, struct ndctl_ctx *ctx)
 		}
 	}
 
-	return 0;
+	error("%s: no such namespace\n", namespace);
+	return rc;
 }
 
 int cmd_inject_error(int argc, const char **argv, void *ctx)
-- 
2.14.3

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-09  6:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-09  5:34 [ndctl PATCH v2 1/4] ndctl, inject-error: error out for a non-existent namespace Vishal Verma
2018-02-09  5:34 ` [ndctl PATCH v2 2/4] ndctl: add ndctl_encode_smart_temperature() Vishal Verma
2018-02-09  5:34 ` [ndctl PATCH v2 3/4] ndctl: add a new command - inject-smart Vishal Verma
2018-02-09  6:31   ` Dan Williams
2018-02-09  5:35 ` [ndctl PATCH v2 4/4] ndctl, bash-completion: Add bash completion for inject-smart Vishal Verma

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.