From 0ef84b80c59b6d15c344b96e3040b2ee367e33ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sun, 12 Jan 2020 12:14:31 +0100 Subject: networkctl: return error or warning when interfaces are not matched We'd just print nothing and exit with 0. If the user gave an explicit name, we should fail. If a pattern didn't match, we should at least warn. $ networkctl status enx54ee75cb1dc0a* --no-pager && echo $? No interfaces matched. 0 $ networkctl status enx54ee75cb1dc0a --no-pager Interface "enx54ee75cb1dc0a" not found. 1 --- src/test/test-strv.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/test/test-strv.c') diff --git a/src/test/test-strv.c b/src/test/test-strv.c index f31ea6f8c6..b8001dfe70 100644 --- a/src/test/test-strv.c +++ b/src/test/test-strv.c @@ -924,14 +924,16 @@ static void test_foreach_string(void) { static void test_strv_fnmatch(void) { _cleanup_strv_free_ char **v = NULL; + size_t pos; log_info("/* %s */", __func__); assert_se(!strv_fnmatch(STRV_MAKE_EMPTY, "a", 0)); - v = strv_new("*\\*"); - assert_se(!strv_fnmatch(v, "\\", 0)); - assert_se(strv_fnmatch(v, "\\", FNM_NOESCAPE)); + v = strv_new("xxx", "*\\*", "yyy"); + assert_se(!strv_fnmatch_full(v, "\\", 0, NULL)); + assert_se(strv_fnmatch_full(v, "\\", FNM_NOESCAPE, &pos)); + assert(pos == 1); } int main(int argc, char *argv[]) { -- cgit v1.2.1