diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-04-29 01:17:36 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-04-29 09:07:42 +0900 |
commit | fd221544f22ecc01998956ffd5e5c2470e94501b (patch) | |
tree | 56b5b7c38ff5ccd048978fd8222f7200e1cfdb03 /src/network/networkd-util.c | |
parent | e558d4f47a9c01b007fc193cabcf0dea8370a5f1 (diff) | |
download | systemd-fd221544f22ecc01998956ffd5e5c2470e94501b.tar.gz |
network: unify log_link_message_full_errno() and log_message_warning_errno()
This also introduces log_message_error_errno() or friends.
Diffstat (limited to 'src/network/networkd-util.c')
-rw-r--r-- | src/network/networkd-util.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/network/networkd-util.c b/src/network/networkd-util.c index a9dd6d45eb..43ddf124d4 100644 --- a/src/network/networkd-util.c +++ b/src/network/networkd-util.c @@ -2,6 +2,7 @@ #include "condition.h" #include "conf-parser.h" +#include "networkd-link.h" #include "networkd-util.h" #include "parse-util.h" #include "string-table.h" @@ -223,3 +224,17 @@ unsigned hashmap_find_free_section_line(Hashmap *hashmap) { return n + 1; } + +int log_link_message_full_errno(Link *link, sd_netlink_message *m, int level, int err, const char *msg) { + const char *err_msg = NULL; + + /* link may be NULL. */ + + (void) sd_netlink_message_read_string(m, NLMSGERR_ATTR_MSG, &err_msg); + return log_link_full_errno(link, level, err, + "%s: %s%s%s%m", + msg, + strempty(err_msg), + err_msg && !endswith(err_msg, ".") ? "." : "", + err_msg ? " " : ""); +} |