diff options
author | Thomas Haller <thaller@redhat.com> | 2020-05-11 14:45:09 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-05-11 16:18:22 +0200 |
commit | 0d7d2425c413a2c798eab8afc5738b8051917825 (patch) | |
tree | 9788c8bbc1d94c3c12523605bd46864baa516de4 | |
parent | 2027ff50af7572ffb08331f6bc79c39ad7d4f5f4 (diff) | |
download | NetworkManager-0d7d2425c413a2c798eab8afc5738b8051917825.tar.gz |
ethtool: accept %NULL as argument for nm_ethtool_data_get_by_optname()/nm_ethtool_id_get_by_name()
Often it is useful to not accept %NULL as input argument, to catch bugs.
For simple functions like nm_ethtool_id_get_by_name(), such limitations
are more annoying than helpful. Gracefully accept %NULL and treat is
like an invalid ethtool option.
-rw-r--r-- | shared/nm-libnm-core-intern/nm-ethtool-utils.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/shared/nm-libnm-core-intern/nm-ethtool-utils.c b/shared/nm-libnm-core-intern/nm-ethtool-utils.c index f080b5c173..ace47680f5 100644 --- a/shared/nm-libnm-core-intern/nm-ethtool-utils.c +++ b/shared/nm-libnm-core-intern/nm-ethtool-utils.c @@ -196,7 +196,8 @@ nm_ethtool_data_get_by_optname (const char *optname) { gssize idx; - nm_assert (optname); + if (!optname) + return NULL; _ASSERT_data (); |