mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-11 05:17:44 +03:00
sd-{login,netlink,network}: use TAKE_FD() in more places
This commit is contained in:
parent
90e207e41f
commit
d52e1c420c
@ -997,20 +997,13 @@ _public_ int sd_login_monitor_new(const char *category, sd_login_monitor **m) {
|
||||
if (!good)
|
||||
return -EINVAL;
|
||||
|
||||
*m = FD_TO_MONITOR(fd);
|
||||
fd = -1;
|
||||
|
||||
*m = FD_TO_MONITOR(TAKE_FD(fd));
|
||||
return 0;
|
||||
}
|
||||
|
||||
_public_ sd_login_monitor* sd_login_monitor_unref(sd_login_monitor *m) {
|
||||
int fd;
|
||||
|
||||
if (!m)
|
||||
return NULL;
|
||||
|
||||
fd = MONITOR_TO_FD(m);
|
||||
close_nointr(fd);
|
||||
if (m)
|
||||
close_nointr(MONITOR_TO_FD(m));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -135,8 +135,7 @@ int netlink_open_family(sd_netlink **ret, int family) {
|
||||
r = sd_netlink_open_fd(ret, fd);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
fd = -1;
|
||||
TAKE_FD(fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -373,19 +373,13 @@ _public_ int sd_network_monitor_new(sd_network_monitor **m, const char *category
|
||||
if (!good)
|
||||
return -EINVAL;
|
||||
|
||||
*m = FD_TO_MONITOR(fd);
|
||||
fd = -1;
|
||||
|
||||
*m = FD_TO_MONITOR(TAKE_FD(fd));
|
||||
return 0;
|
||||
}
|
||||
|
||||
_public_ sd_network_monitor* sd_network_monitor_unref(sd_network_monitor *m) {
|
||||
int fd;
|
||||
|
||||
if (m) {
|
||||
fd = MONITOR_TO_FD(m);
|
||||
close_nointr(fd);
|
||||
}
|
||||
if (m)
|
||||
close_nointr(MONITOR_TO_FD(m));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user