From 642b5fb0007b64c77d186fcb018d571152ee1d47 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Mon, 14 Aug 2023 18:51:07 +0200 Subject: reorganization: first steps --- src/libc/camellia.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/libc/camellia.c (limited to 'src/libc/camellia.c') diff --git a/src/libc/camellia.c b/src/libc/camellia.c new file mode 100644 index 0000000..4e092e4 --- /dev/null +++ b/src/libc/camellia.c @@ -0,0 +1,30 @@ +#include +#include +#include +#include +#include +#include + +hid_t camellia_open(const char *path, int flags) { + hid_t ret; + char *buf; + size_t len; + + if (path == NULL) + return errno = EINVAL, -EINVAL; + if (flags & OPEN_CREATE) + flags |= OPEN_WRITE; + + len = absolutepath(NULL, path, 0); + buf = malloc(len); + if (!buf) + return -errno; + absolutepath(buf, path, len); + ret = _sys_open(buf, strlen(buf), flags); + free(buf); + + if (ret < 0) + errno = -ret; + + return ret; +} -- cgit v1.2.3