This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/21244] support resolv_test_start() socket fd close should be checked for errors.


https://sourceware.org/bugzilla/show_bug.cgi?id=21244

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com

--- Comment #1 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Carlos O'Donell from comment #0)
> In support/resolv_test.c (resolv_test_start)
> 
> 1026       if (config.servers[server_index].disable_udp)
> 1027         {
> 1028           close (server->socket_udp);
> 1029           server->socket_udp = -1;
> 1030         }
> 1031       else if (!config.single_thread_udp)
> 1032         server->thread_udp = start_server_thread (obj, server_index,
> 1033                                                   server_thread_udp);
> 1034       if (config.servers[server_index].disable_tcp)
> 1035         {
> 1036           close (server->socket_tcp);
> 1037           server->socket_tcp = -1;
> 1038         }
> 1039       else
> 1040         server->thread_tcp = start_server_thread (obj, server_index,
> 1041                                                   server_thread_tcp);
> 
> We should check the results of close() to be thorough.

We should probably have an xclose function for that (which ignores EINTR).

> In theory we are setting socket_udp/socket_tcp to -1 which is an invalid
> handle to pass to close(), but on Linux it returns EBADF and you'd expect it
> to return EBADF on any sensible implementation. We should check for this
> though and issue an appropriate warning showing that an already closed
> handle was closed again.

How does this happen?  We don't close the sockets if disable_udp or disable_tcp
are set.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]