chiark / gitweb /
timesyncd: check return of setting IP_TOS
authorTom Gundersen <teg@jklm.no>
Thu, 18 Sep 2014 21:37:07 +0000 (23:37 +0200)
committerTom Gundersen <teg@jklm.no>
Thu, 18 Sep 2014 21:37:07 +0000 (23:37 +0200)
Fonud by Coverity. Fixes CID #1237534.

src/timesync/timesyncd-manager.c

index a5678cc..46f8bd6 100644 (file)
@@ -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);
 }