diff mbox

[ndctl,12/13] ndctl: fix return code for enable/disable commands

Message ID 20160128225300.17855.16492.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Accepted
Commit f48ecee126e1
Headers show

Commit Message

Dan Williams Jan. 28, 2016, 10:53 p.m. UTC
Returning the number of enabled / disabled devices makes the commands
unusable as a script since non-zero return code equals failure.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 builtin-xable-region.c      |    8 ++++----
 builtin-xaction-namespace.c |    4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/builtin-xable-region.c b/builtin-xable-region.c
index 82bce63fda4b..1de1e97634cf 100644
--- a/builtin-xable-region.c
+++ b/builtin-xable-region.c
@@ -82,11 +82,11 @@  int cmd_disable_region(int argc, const char **argv)
 		return disabled;
 	} else if (disabled == 0) {
 		fprintf(stderr, "disabled 0 regions\n");
-		return -ENXIO;
+		return 0;
 	} else {
 		fprintf(stderr, "disabled %d region%s\n", disabled,
 				disabled > 1 ? "s" : "");
-		return disabled;
+		return 0;
 	}
 }
 
@@ -102,10 +102,10 @@  int cmd_enable_region(int argc, const char **argv)
 		return enabled;
 	} else if (enabled == 0) {
 		fprintf(stderr, "enabled 0 regions\n");
-		return -ENXIO;
+		return 0;
 	} else {
 		fprintf(stderr, "enabled %d region%s\n", enabled,
 				enabled > 1 ? "s" : "");
-		return enabled;
+		return 0;
 	}
 }
diff --git a/builtin-xaction-namespace.c b/builtin-xaction-namespace.c
index 22e949a9ec6d..4135e04d93fd 100644
--- a/builtin-xaction-namespace.c
+++ b/builtin-xaction-namespace.c
@@ -653,11 +653,11 @@  int cmd_enable_namespace(int argc, const char **argv)
 		return enabled;
 	} else if (enabled == 0) {
 		fprintf(stderr, "enabled 0 namespaces\n");
-		return -ENXIO;
+		return 0;
 	} else {
 		fprintf(stderr, "enabled %d namespace%s\n", enabled,
 				enabled > 1 ? "s" : "");
-		return enabled;
+		return 0;
 	}
 }