From 2f905e821e0342c36f5a5d3a51d53aabccc800bd Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Thu, 18 Sep 2014 23:37:07 +0200
Subject: [PATCH] timesyncd: check return of setting IP_TOS
Fonud by Coverity. Fixes CID #1237534.
---
src/timesync/timesyncd-manager.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
index a5678ccaed..46f8bd6d81 100644
--- a/src/timesync/timesyncd-manager.c
+++ b/src/timesync/timesyncd-manager.c
@@ -721,7 +721,9 @@ static int manager_listen_setup(Manager *m) {
if (r < 0)
return -errno;
- setsockopt(m->server_socket, IPPROTO_IP, IP_TOS, &tos, sizeof(tos));
+ r = setsockopt(m->server_socket, IPPROTO_IP, IP_TOS, &tos, sizeof(tos));
+ if (r < 0)
+ return -errno;
return sd_event_add_io(m->event, &m->event_receive, m->server_socket, EPOLLIN, manager_receive_response, m);
}