From 43fcdc43e6b5498567cf74677683051c56c87683 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Tue, 21 Feb 2017 15:24:26 +0100 Subject: [PATCH] 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 --- repos/libports/src/lib/libc/socket_fs_plugin.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/repos/libports/src/lib/libc/socket_fs_plugin.cc b/repos/libports/src/lib/libc/socket_fs_plugin.cc index 942f656d1b..b07338af84 100644 --- a/repos/libports/src/lib/libc/socket_fs_plugin.cc +++ b/repos/libports/src/lib/libc/socket_fs_plugin.cc @@ -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);