libc: silence calls of getpeername w/o socket fs
The getpeername function is provided only by the socket fs. In the case where the socket fs is not configured, return an appropriate errno instead probing for a libc plugin (there is none). Issue #3578
This commit is contained in:
parent
ae64830bd5
commit
5853a68904
|
@ -22,12 +22,12 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <libc_private.h>
|
#include <libc_private.h>
|
||||||
#include <errno.h>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* libc-internal includes */
|
/* libc-internal includes */
|
||||||
#include <internal/file.h>
|
#include <internal/file.h>
|
||||||
#include <internal/socket_fs_plugin.h>
|
#include <internal/socket_fs_plugin.h>
|
||||||
|
#include <internal/errno.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace Libc;
|
using namespace Libc;
|
||||||
|
@ -52,7 +52,7 @@ extern "C" int getpeername(int libc_fd, sockaddr *addr, socklen_t *addrlen)
|
||||||
if (*config_socket())
|
if (*config_socket())
|
||||||
return socket_fs_getpeername(libc_fd, addr, addrlen);
|
return socket_fs_getpeername(libc_fd, addr, addrlen);
|
||||||
|
|
||||||
FD_FUNC_WRAPPER(getpeername, libc_fd, addr, addrlen);
|
return Libc::Errno(ENOTSOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue