From b661513245e5bc07358237a39e4d100d124f64fc Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Fri, 31 Jul 2020 17:10:39 +0200 Subject: slave: user-notifications: emit errors first, then warnings and last deprecations --- slave.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/slave.c b/slave.c index c28613c0..8019f20c 100644 --- a/slave.c +++ b/slave.c @@ -102,9 +102,28 @@ emit_one_notification(int fd, const struct user_notification *notif) static bool emit_notifications(int fd, const user_notifications_t *notifications) { + /* Errors first */ tll_foreach(*notifications, it) { - if (!emit_one_notification(fd, &it->item)) - return false; + if (it->item.kind == USER_NOTIFICATION_ERROR) { + if (!emit_one_notification(fd, &it->item)) + return false; + } + } + + /* Then warnings */ + tll_foreach(*notifications, it) { + if (it->item.kind == USER_NOTIFICATION_WARNING) { + if (!emit_one_notification(fd, &it->item)) + return false; + } + } + + /* Finally deprecation messages */ + tll_foreach(*notifications, it) { + if (it->item.kind == USER_NOTIFICATION_DEPRECATED) { + if (!emit_one_notification(fd, &it->item)) + return false; + } } return true; -- cgit v1.3