diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-01-12 12:14:31 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-01-14 13:09:46 +0100 |
commit | 0ef84b80c59b6d15c344b96e3040b2ee367e33ac (patch) | |
tree | e7e9fce4475cf518c800dc243e5f4bb7086bd32e /src/test/test-strv.c | |
parent | initctl: (void)ify epoll_ctl() (diff) | |
download | systemd-0ef84b80c59b6d15c344b96e3040b2ee367e33ac.tar.xz systemd-0ef84b80c59b6d15c344b96e3040b2ee367e33ac.zip |
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
Diffstat (limited to '')
-rw-r--r-- | src/test/test-strv.c | 8 |
1 files changed, 5 insertions, 3 deletions
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[]) { |