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:
Norman Feske 2019-12-04 16:33:39 +01:00 committed by Christian Helmuth
parent ae64830bd5
commit 5853a68904
1 changed files with 2 additions and 2 deletions

View File

@ -22,12 +22,12 @@
extern "C" {
#include <sys/wait.h>
#include <libc_private.h>
#include <errno.h>
}
/* libc-internal includes */
#include <internal/file.h>
#include <internal/socket_fs_plugin.h>
#include <internal/errno.h>
using namespace Libc;
@ -52,7 +52,7 @@ extern "C" int getpeername(int libc_fd, sockaddr *addr, socklen_t *addrlen)
if (*config_socket())
return socket_fs_getpeername(libc_fd, addr, addrlen);
FD_FUNC_WRAPPER(getpeername, libc_fd, addr, addrlen);
return Libc::Errno(ENOTSOCK);
}