Alex Chen <alex.c...@huawei.com> 于2020年11月26日周四 下午6:29写道: > > Only one of the options -s and -f can be used. When -f is used, > the fd is created externally and does not need to be closed. > When -s is used, a new socket fd is created, and this socket fd > needs to be closed at the end of main(). > > Reported-by: Euler Robot <euler.ro...@huawei.com> > Signed-off-by: Alex Chen <alex.c...@huawei.com> > --- > fsdev/virtfs-proxy-helper.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c > index 15c0e79b06..339d477169 100644 > --- a/fsdev/virtfs-proxy-helper.c > +++ b/fsdev/virtfs-proxy-helper.c > @@ -1154,6 +1154,9 @@ int main(int argc, char **argv) > process_requests(sock); > error: > g_free(rpath); > + if (sock_name) { > + close(sock); > + }
If 'proxy_socket' failed, you call close(-1). Maybe following is better? if (sock >= 0) { close(sock); } Thanks, Li Qiang > g_free(sock_name); > do_log(LOG_INFO, "Done\n"); > closelog(); > -- > 2.19.1 > >