lib/ipc: client double close of socket file descriptor #431

When connect() fails in connect_unix() the path_ctx.fd is not
set to -1 after close().  When common_release() is executed due
to the error return from connect_unix() it calls close() a second
time.

There is no need to call close() from connect_unix(). Remove the
duplicate request.

This issue was reported by YASUOKA Masahiko.

Change-Id: I825e274cc7f12e50a8779a2b62ddb756817cdb52
This commit is contained in:
Jeffrey Altman
2018-12-26 12:55:51 -05:00
committed by Jeffrey Altman
parent becb0b03ae
commit 60b25dd9c5

View File

@@ -332,10 +332,8 @@ connect_unix(struct path_ctx *s)
return errno; return errno;
rk_cloexec(s->fd); rk_cloexec(s->fd);
if (connect(s->fd, (struct sockaddr *)&addr, sizeof(addr)) != 0) { if (connect(s->fd, (struct sockaddr *)&addr, sizeof(addr)) != 0)
close(s->fd);
return errno; return errno;
}
return 0; return 0;
} }