diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-12-11 17:27:09 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-12-14 10:57:43 +0100 |
commit | c2aed128369218eb280faade3209be99c5de5eb1 (patch) | |
tree | 7e9788996ae68a154dffd4c15ec8e617f12b95bd /src/network/networkd-link.c | |
parent | Add $SYSTEMD_HWDB_UPDATE_BYPASS (#30463) (diff) | |
download | systemd-c2aed128369218eb280faade3209be99c5de5eb1.tar.xz systemd-c2aed128369218eb280faade3209be99c5de5eb1.zip |
network: do not trigger assertion when link_get_by_index() called with an invalid ifindex
Should not change any behavior. Preparation for later commit.
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r-- | src/network/networkd-link.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index a063696c82..0162e2acb0 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -252,7 +252,9 @@ int link_get_by_index(Manager *m, int ifindex, Link **ret) { Link *link; assert(m); - assert(ifindex > 0); + + if (ifindex <= 0) + return -EINVAL; link = hashmap_get(m->links_by_index, INT_TO_PTR(ifindex)); if (!link) |