libc/socket_fs: warn on unexpected arg in shutdown

Our 'shutdown' implementation handles only the case that 'how' is 'RDWR'.
Thus, print an error and continue if a user calls it with another value.

Fixes #2285
This commit is contained in:
Martin Stein 2017-02-21 15:24:26 +01:00 committed by Christian Helmuth
parent 1a6963813c
commit 43fcdc43e6
1 changed files with 5 additions and 0 deletions

View File

@ -627,6 +627,11 @@ extern "C" int socket_fs_shutdown(int libc_fd, int how)
{
/* TODO ENOTCONN */
if (how != SHUT_RDWR) {
Genode::error("function '", __func__ , "' only implemented for 'how",
"value 'SHUT_RDWR'");
}
Libc::File_descriptor *fd = Libc::file_descriptor_allocator()->find_by_libc_fd(libc_fd);
if (!fd)
return Errno(EBADF);