Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaf89c02

Browse files
committed
notify_socket: close fds on error
Reported in issue 5008.Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
1 parent8702e12 commitaf89c02

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎notify_socket.go‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,18 @@ func notifyHost(client *net.UnixConn, ready []byte, pid1 int) error {
175175
varerrUnexpectedRead=errors.New("unexpected read from synchronization pipe")
176176

177177
// sdNotifyBarrier performs synchronization with systemd by means of the sd_notify_barrier protocol.
178-
funcsdNotifyBarrier(client*net.UnixConn)error {
178+
funcsdNotifyBarrier(client*net.UnixConn)(retErrerror) {
179179
// Create a pipe for communicating with systemd daemon.
180180
pipeR,pipeW,err:=os.Pipe()
181181
iferr!=nil {
182182
returnerr
183183
}
184+
deferfunc() {
185+
ifretErr!=nil {
186+
pipeW.Close()
187+
pipeR.Close()
188+
}
189+
}()
184190

185191
// Get the FD for the unix socket file to be able to use sendmsg.
186192
clientFd,err:=client.File()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp