diff --git a/include/bits/stdio.h b/include/bits/stdio.h index 03253c3fd271eff7179dd4b0193b155bf3b58357..073ea11203b9e9e963190cac041b1b3fa585937e 100644 --- a/include/bits/stdio.h +++ b/include/bits/stdio.h @@ -1,6 +1,8 @@ #ifndef _BITS_STDIO_H #define _BITS_STDIO_H +#define EOF (-1) + int fprintf(FILE * stream, const char * fmt, ...); int printf(const char * fmt, ...); int snprintf(char *s, size_t n, const char * fmt, ...); diff --git a/ralloc b/ralloc index 25ac80dd96c7fc0a7116068a74abe1c86102f7e8..2d8d44970eb5bb2ecc55f5ced8a33f21ed9407f4 160000 --- a/ralloc +++ b/ralloc @@ -1 +1 @@ -Subproject commit 25ac80dd96c7fc0a7116068a74abe1c86102f7e8 +Subproject commit 2d8d44970eb5bb2ecc55f5ced8a33f21ed9407f4 diff --git a/src/platform/src/redox/mod.rs b/src/platform/src/redox/mod.rs index cae80d96557768d90f69cd2e913389a8d8a8915e..56eed2b259393dafc12a79ba02135f94c6c7cd5c 100644 --- a/src/platform/src/redox/mod.rs +++ b/src/platform/src/redox/mod.rs @@ -265,11 +265,11 @@ pub fn read(fd: c_int, buf: &mut [u8]) -> ssize_t { e(syscall::read(fd as usize, buf)) as ssize_t } -pub fn rename(old: *const c_char, new: *const c_char) -> c_int { - let (old_path, new_path) = unsafe { (c_str(old), c_str(new)) }; - match syscall::open(old_path, O_WRONLY) { +pub fn rename(oldpath: *const c_char, newpath: *const c_char) -> c_int { + let (oldpath, newpath) = unsafe { (c_str(oldpath), c_str(newpath)) }; + match syscall::open(oldpath, O_WRONLY) { Ok(fd) => { - let retval = syscall::frename(fd, new_path); + let retval = syscall::frename(fd, newpath); let _ = syscall::close(fd); e(retval) as c_int } diff --git a/src/stdio/src/lib.rs b/src/stdio/src/lib.rs index fb2447a0e394ef4678ab21beb5340eb9c9310a4b..e9d562df44fb6d650554847813016899bc62f22e 100644 --- a/src/stdio/src/lib.rs +++ b/src/stdio/src/lib.rs @@ -760,8 +760,8 @@ pub extern "C" fn remove(path: *const c_char) -> c_int { } #[no_mangle] -pub extern "C" fn rename(old: *const c_char, new: *const c_char) -> c_int { - platform::rename(old, new) +pub extern "C" fn rename(oldpath: *const c_char, newpath: *const c_char) -> c_int { + platform::rename(oldpath, newpath) } /// Rewind `stream` back to the beginning of it diff --git a/src/stdlib/src/lib.rs b/src/stdlib/src/lib.rs index f21fe45e228116735efa5082011b7a4d36d5c9d7..0599189e2bd546b755852738a056de124fc63820 100644 --- a/src/stdlib/src/lib.rs +++ b/src/stdlib/src/lib.rs @@ -354,12 +354,12 @@ pub extern "C" fn mbtowc(pwc: *mut wchar_t, s: *const c_char, n: size_t) -> c_in } #[no_mangle] -pub extern "C" fn mktemp(template: *mut c_char) -> *mut c_char { +pub extern "C" fn mktemp(name: *mut c_char) -> *mut c_char { unimplemented!(); } #[no_mangle] -pub extern "C" fn mkstemp(template: *mut c_char) -> c_int { +pub extern "C" fn mkstemp(name: *mut c_char) -> c_int { unimplemented!(); } diff --git a/tests/rename.c b/tests/rename.c index 89c5db3194cbfa0294469e7f28f77d95662c1af5..189ba227712dd49b467503d571c7c821ffa91529 100644 --- a/tests/rename.c +++ b/tests/rename.c @@ -3,22 +3,22 @@ #include <string.h> #include <unistd.h> -static char old[] = "old-name.out"; -static char new[] = "new-name.out"; +static char oldpath[] = "old-name.out"; +static char newpath[] = "new-name.out"; static char str[] = "Hello, World!"; int str_len = 13; int main() { char buf[14]; buf[13] = 0x00; - int fd = creat(old, 0777); + int fd = creat(oldpath, 0777); write(fd, str, str_len); close(fd); - rename(old, new); - fd = open(new, O_RDONLY); + rename(oldpath, newpath); + fd = open(newpath, O_RDONLY); read(fd, buf, str_len); close(fd); - remove(new); + remove(newpath); if (strcmp(str, buf) == 0) { return 0; } else {