Merge pull request #83 from fjtrujy/passwd

Improve getpgwan and getpwuid
This commit is contained in:
Francisco Javier Trujillo Mata
2022-01-13 20:48:06 +01:00
committed by GitHub
2 changed files with 14 additions and 6 deletions

View File

@@ -24,8 +24,8 @@ ERRNO_OBJS = __set_errno.o
FDMAN_OBJS = __descriptor_data_pool.o __descriptormap.o __fdman_init.o __fdman_get_new_descriptor.o __fdman_get_dup_descriptor.o \
__fdman_release_descriptor.o
GLUE_OBJS = __fill_stat.o __psp_heap_blockid.o __psp_free_heap.o _fork.o _wait.o _open.o _close.o _read.o _write.o _fstat.o \
_stat.o lstat.o access.o _fcntl.o _lseek.o chdir.o mkdir.o rmdir.o getdents.o _seekdir.o _link.o _unlink.o \
GLUE_OBJS = __dummy_passwd.o __fill_stat.o __psp_heap_blockid.o __psp_free_heap.o _fork.o _wait.o _open.o _close.o _read.o \
_write.o _fstat.o _stat.o lstat.o access.o _fcntl.o _lseek.o chdir.o mkdir.o rmdir.o getdents.o _seekdir.o _link.o _unlink.o \
_rename.o _getpid.o _kill.o _sbrk.o _gettimeofday.o _times.o ftime.o _internal_malloc_lock.o _internal_malloc_unlock.o \
_isatty.o symlink.o truncate.o chmod.o fchmod.o fchmodat.o pathconf.o readlink.o utime.o fchown.o getentropy.o getpwuid.o \
fsync.o getpwnam.o getuid.o geteuid.o

View File

@@ -70,6 +70,14 @@ int __pipe_nonblocking_write(int fd, const void *buf, size_t len);
/* Functions from socket.c */
int __socket_close(int sock);
#ifdef F___dummy_passwd
/* the present working directory variable. */
struct passwd __dummy_passwd = { "psp_user", "xxx", 1000, 1000, "", "", "/", "" };
#else
extern struct passwd __dummy_passwd;
#endif
#ifdef F___fill_stat
static time_t psp_to_posix_time(ScePspDateTime psp_time)
{
@@ -950,27 +958,27 @@ int fsync(int fd) {
#ifdef F_getuid
uid_t getuid(void) {
return 1000;
return __dummy_passwd.pw_uid;
}
#endif
#ifdef F_geteuid
uid_t geteuid(void) {
return 1000;
return __dummy_passwd.pw_uid;
}
#endif
#ifdef F_getpwuid
struct passwd *getpwuid(uid_t uid) {
/* There's no support for users */
return NULL;
return &__dummy_passwd;
}
#endif
#ifdef F_getpwnam
struct passwd *getpwnam(const char *name) {
/* There's no support for users */
return NULL;
return &__dummy_passwd;
}
#endif