On Wed, Apr 25, 2018 at 12:38 AM, QI Fuli <qi.fuli(a)jp.fujitsu.com> wrote:
This is a follow up patch for commit c70adc3cf6bf ("ndctl,
filter: refactor
util_<obj>_filter() to support multiple space-seperated arguments")
refactored util_<obj>_filter() to support multiple space-seperated arguments.
But, when the keyword "all" is included in space-seperated arguments,
it will be treaded as <object>'s name. This patch fixes it.
Signed-off-by: QI Fuli <qi.fuli(a)jp.fujitsu.com>
---
util/filter.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/util/filter.c b/util/filter.c
index 0d3cc02..9081a6d 100644
--- a/util/filter.c
+++ b/util/filter.c
@@ -40,6 +40,9 @@ struct ndctl_bus *util_bus_filter(struct ndctl_bus *bus, const char
*__ident)
for (name = strtok_r(ident, " ", &save); name;
name = strtok_r(NULL, " ", &save)) {
+ if (strcmp(ident, "all") == 0)
+ break;
+
Let's also remove the strcmp(__ident, "all") at the top of each of
these routines to keep the check for "all" centralized.