]>
Commit | Line | Data |
---|---|---|
320054e8 DG |
1 | // Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/ |
2 | // | |
3 | // SPDX-License-Identifier: BSD-2-Clause | |
4 | ||
446cb3f1 | 5 | #include <wasi/api.h> |
320054e8 DG |
6 | #include <errno.h> |
7 | #include <fcntl.h> | |
8 | #include <string.h> | |
9 | #include <unistd.h> | |
10 | ||
f2e779e5 | 11 | int __wasilibc_nocwd_linkat(int fd1, const char *path1, int fd2, const char *path2, int flag) { |
320054e8 | 12 | // Create lookup properties. |
320054e8 | 13 | __wasi_lookupflags_t lookup1_flags = 0; |
320054e8 | 14 | if ((flag & AT_SYMLINK_FOLLOW) != 0) |
446cb3f1 | 15 | lookup1_flags |= __WASI_LOOKUPFLAGS_SYMLINK_FOLLOW; |
320054e8 DG |
16 | |
17 | // Perform system call. | |
2b7e73ae | 18 | __wasi_errno_t error = __wasi_path_link(fd1, lookup1_flags, path1, fd2, path2); |
320054e8 | 19 | if (error != 0) { |
320054e8 DG |
20 | return -1; |
21 | } | |
22 | return 0; | |
23 | } |