Kernel/LibC: Implement readlink in terms of readlinkat
This commit is contained in:
@@ -55,7 +55,6 @@ __BEGIN_DECLS
|
||||
O(SYS_FCHMOD, fchmod) \
|
||||
O(SYS_CREATE_DIR, create_dir) \
|
||||
O(SYS_UNLINK, unlink) \
|
||||
O(SYS_READLINK, readlink) \
|
||||
O(SYS_READLINKAT, readlinkat) \
|
||||
O(SYS_MSYNC, msync) \
|
||||
O(SYS_PREAD, pread) \
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <kernel/Syscall.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <pwd.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
@@ -86,7 +87,7 @@ ssize_t write(int fildes, const void* buf, size_t nbyte)
|
||||
|
||||
ssize_t readlink(const char* __restrict path, char* __restrict buf, size_t bufsize)
|
||||
{
|
||||
return syscall(SYS_READLINK, path, buf, bufsize);
|
||||
return readlinkat(AT_FDCWD, path, buf, bufsize);
|
||||
}
|
||||
|
||||
ssize_t readlinkat(int fd, const char* __restrict path, char* __restrict buf, size_t bufsize)
|
||||
|
||||
Reference in New Issue
Block a user