mirror of
https://github.com/pspdev/pspsdk.git
synced 2025-12-24 04:32:36 +00:00
add realpath
This commit is contained in:
@@ -29,7 +29,8 @@ GLUE_OBJS = __dummy_passwd.o __psp_heap_blockid.o __psp_free_heap.o _fork.o _wai
|
||||
_rename.o _getpid.o _kill.o _sbrk.o _gettimeofday.o _times.o ftime.o clock_getres.o clock_gettime.o clock_settime.o \
|
||||
_isatty.o symlink.o truncate.o chmod.o fchmod.o pathconf.o readlink.o utime.o fchown.o _getentropy.o getpwuid.o \
|
||||
fsync.o getpwnam.o getuid.o geteuid.o basename.o statvfs.o \
|
||||
openat.o renameat.o fchmodat.o fstatat.o mkdirat.o faccessat.o fchownat.o linkat.o readlinkat.o unlinkat.o
|
||||
openat.o renameat.o fchmodat.o fstatat.o mkdirat.o faccessat.o fchownat.o linkat.o readlinkat.o unlinkat.o \
|
||||
realpath.o
|
||||
|
||||
INIT_OBJS = __libpthreadglue_init.o __libcglue_init.o __libcglue_deinit.o _exit.o abort.o exit.o
|
||||
|
||||
|
||||
@@ -1179,3 +1179,25 @@ int unlinkat(int dirfd, const char *pathname, int flags)
|
||||
}
|
||||
}
|
||||
#endif /* F_unlinkat */
|
||||
|
||||
#ifdef F_realpath
|
||||
char *realpath(const char *path, char *resolved_path)
|
||||
{
|
||||
if (path == NULL) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (resolved_path == NULL) {
|
||||
resolved_path = malloc(PATH_MAX);
|
||||
if (resolved_path == NULL) {
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
__path_absolute(path, resolved_path, PATH_MAX);
|
||||
|
||||
return resolved_path;
|
||||
}
|
||||
#endif /* F_realpath */
|
||||
Reference in New Issue
Block a user