]> git.proxmox.com Git - wasi-libc.git/blame - libc-bottom-half/cloudlibc/src/libc/stdio/renameat.c
Remove __wasilibc_unmodified_upstream markers from libc-bottom-half.
[wasi-libc.git] / libc-bottom-half / cloudlibc / src / libc / stdio / renameat.c
CommitLineData
320054e8
DG
1// Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/
2//
3// SPDX-License-Identifier: BSD-2-Clause
4
5#include <common/errno.h>
6
446cb3f1 7#include <wasi/api.h>
320054e8
DG
8#include <errno.h>
9#include <stdio.h>
10#include <string.h>
11
12int renameat(int oldfd, const char *old, int newfd, const char *new) {
320054e8 13 __wasi_errno_t error = __wasi_path_rename(oldfd, old, strlen(old),
cab0ec60 14 newfd, new, strlen(new));
320054e8
DG
15 if (error != 0) {
16 errno = errno_fixup_directory(oldfd, errno_fixup_directory(newfd, error));
17 return -1;
18 }
19 return 0;
20}