diff options
author | Mike Yuan <me@yhndnzj.com> | 2023-04-02 20:20:32 +0200 |
---|---|---|
committer | Mike Yuan <me@yhndnzj.com> | 2023-05-21 09:46:22 +0200 |
commit | 6c6930077cdc705b3c2f5b28aa0af7c49e16fade (patch) | |
tree | 15e5d15920823c27b3d9a99323cafe521bb2208e /src/network | |
parent | Merge pull request #27719 from mrc0mmand/fuzz-tweaks (diff) | |
download | systemd-6c6930077cdc705b3c2f5b28aa0af7c49e16fade.tar.xz systemd-6c6930077cdc705b3c2f5b28aa0af7c49e16fade.zip |
networkctl: check netns only if networkd is running
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkctl.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/network/networkctl.c b/src/network/networkctl.c index 9b21afe405..5ef3cbabec 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -120,12 +120,12 @@ static int acquire_bus(sd_bus **ret) { if (r < 0) return log_error_errno(r, "Failed to connect system bus: %m"); - r = check_netns_match(bus); - if (r < 0) - return r; - - if (!networkd_is_running()) - fprintf(stderr, "WARNING: systemd-networkd is not running, output will be incomplete.\n\n"); + if (networkd_is_running()) { + r = check_netns_match(bus); + if (r < 0) + return r; + } else + log_warning("systemd-networkd is not running, output might be incomplete."); *ret = TAKE_PTR(bus); return 0; |