summaryrefslogtreecommitdiff
path: root/src/timesync
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-05-05 21:47:38 +0200
committerLennart Poettering <lennart@poettering.net>2014-05-05 21:47:38 +0200
commit7ed0dd4be6ef4e73d7fb2fc1e80e6f9405c2f257 (patch)
tree09a6665c853e636a355026a1e88f19dd974958cf /src/timesync
parent5f8cfaee52745c885ea4148cd720c71ee5efc742 (diff)
timesync: use safe_close() where possible
Diffstat (limited to 'src/timesync')
-rw-r--r--src/timesync/timesyncd.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/timesync/timesyncd.c b/src/timesync/timesyncd.c
index 72dcf0b058..3cf3579576 100644
--- a/src/timesync/timesyncd.c
+++ b/src/timesync/timesyncd.c
@@ -319,8 +319,7 @@ static int sntp_clock_watch_setup(Manager *m) {
sd_event_source_unref(m->event_clock_watch);
m->event_clock_watch = source;
- if (m->clock_watch_fd >= 0)
- close(m->clock_watch_fd);
+ safe_close(m->clock_watch_fd);
m->clock_watch_fd = fd;
fd = -1;
@@ -680,14 +679,10 @@ static void sntp_server_disconnect(Manager *m) {
m->event_timer = sd_event_source_unref(m->event_timer);
m->event_clock_watch = sd_event_source_unref(m->event_clock_watch);
- if (m->clock_watch_fd > 0)
- close(m->clock_watch_fd);
- m->clock_watch_fd = -1;
+ m->clock_watch_fd = safe_close(m->clock_watch_fd);
m->event_receive = sd_event_source_unref(m->event_receive);
- if (m->server_socket > 0)
- close(m->server_socket);
- m->server_socket = -1;
+ m->server_socket = safe_close(m->server_socket);
zero(m->server_addr);
free(m->server);