diff options
author | Mattias Andrée <maandree@kth.se> | 2019-04-12 21:12:31 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2019-04-12 21:13:37 +0200 |
commit | bafb07a1644896d56ad4b8effaeaae601c5a275b (patch) | |
tree | ef4e38f529ba2f0cadc73ad88493a1cca206fe7b /shutdown.c | |
download | liberror-libc-bafb07a1644896d56ad4b8effaeaae601c5a275b.tar.gz liberror-libc-bafb07a1644896d56ad4b8effaeaae601c5a275b.tar.bz2 liberror-libc-bafb07a1644896d56ad4b8effaeaae601c5a275b.tar.xz |
First commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'shutdown.c')
-rw-r--r-- | shutdown.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/shutdown.c b/shutdown.c new file mode 100644 index 0000000..3ccdfd0 --- /dev/null +++ b/shutdown.c @@ -0,0 +1,33 @@ +/* See LICENSE file for copyright and license details. */ +#include "internal.h" + + +int +liberror_shutdown(int fd, int how) +{ + const char *desc; + if (!shutdown(fd, how)) + return 0; + switch (errno) { + case EBADF: + desc = fd < 0 ? "Negative file descriptor number specified" : "Unassigned file descriptor number specified"; + break; + case EINVAL: + desc = "Invalid value of second parameter"; + break; + case ENOTCONN: + desc = "The socket is not connected"; + break; + case ENOTSOCK: + desc = "The specified file is not a socket"; + break; + case ENOBUFS: + desc = "Insufficient resource available in the system to perform the operation"; + break; + default: + desc = ""; + break; + } + liberror_set_error_errno(desc, "shutdown", errno); + return -1; +} |