Mercurial > hg > dhcpcd
changeset 4957:2c96d2b00ed7 draft
Linux: close the netlink privsep socket once done.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Tue, 14 Jan 2020 11:53:29 +0000 |
| parents | 51ee8eedecfa |
| children | a120f447fe74 |
| files | src/privsep-linux.c |
| diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/privsep-linux.c Tue Jan 14 11:53:05 2020 +0000 +++ b/src/privsep-linux.c Tue Jan 14 11:53:29 2020 +0000 @@ -48,14 +48,20 @@ .iov_base = buf, .iov_len = sizeof(buf), }; + ssize_t retval; if ((s = if_linksocket(&snl, protocol)) == -1) return -1; - if (sendmsg(s, msg, 0) == -1) - return -1; + if (sendmsg(s, msg, 0) == -1) { + retval = -1; + goto out; + } - return if_getnetlink(NULL, &riov, s, 0, NULL, NULL); + retval = if_getnetlink(NULL, &riov, s, 0, NULL, NULL); +out: + close(s); + return retval; } static ssize_t
