]> git.proxmox.com Git - wasi-libc.git/blob - libc-bottom-half/cloudlibc/src/libc/stdio/renameat.c
Update to the next version of the `witx` crate (#234)
[wasi-libc.git] / libc-bottom-half / cloudlibc / src / libc / stdio / renameat.c
1 // Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/
2 //
3 // SPDX-License-Identifier: BSD-2-Clause
4
5 #include <common/errno.h>
6
7 #include <wasi/api.h>
8 #include <errno.h>
9 #include <stdio.h>
10 #include <string.h>
11
12 int __wasilibc_nocwd_renameat(int oldfd, const char *old, int newfd, const char *new) {
13 __wasi_errno_t error = __wasi_path_rename(oldfd, old, newfd, new);
14 if (error != 0) {
15 errno = errno_fixup_directory(oldfd, errno_fixup_directory(newfd, error));
16 return -1;
17 }
18 return 0;
19 }