mirror of
https://github.com/troglobit/finit.git
synced 2026-11-03 13:28:27 +00:00
libsystemd: fix socket leak in sd_notify()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 file changed
+2
-3
@@ -78,10 +78,9 @@ int sd_notify(int unset_environment, const char *state)
|
|||||||
unsetenv("NOTIFY_SOCKET");
|
unsetenv("NOTIFY_SOCKET");
|
||||||
|
|
||||||
written = write(sd, state, len);
|
written = write(sd, state, len);
|
||||||
if (written != (ssize_t) len) {
|
close(sd);
|
||||||
close(sd);
|
if (written != (ssize_t) len)
|
||||||
return written < 0 ? -errno : -EPROTO;
|
return written < 0 ? -errno : -EPROTO;
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user