diff options
author | dzwdz | 2023-08-14 18:51:07 +0200 |
---|---|---|
committer | dzwdz | 2023-08-14 18:51:07 +0200 |
commit | 642b5fb0007b64c77d186fcb018d571152ee1d47 (patch) | |
tree | 1c466461f3602d306be309a053edae558ef2568e /src/libc/camellia.c | |
parent | 8050069c57b729c18c19b1a03ab6e4bf63b4735e (diff) |
reorganization: first steps
Diffstat (limited to 'src/libc/camellia.c')
-rw-r--r-- | src/libc/camellia.c | 30 |
1 files changed, 30 insertions, 0 deletions
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 <camellia.h> +#include <camellia/syscalls.h> +#include <errno.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +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; +} |