Skip to content

Commit

Permalink
Merge pull request #525 from uyjulian/fstat_cond_check
Browse files Browse the repository at this point in the history
Check if _fstat is existent for stat operation
  • Loading branch information
fjtrujy authored Feb 6, 2024
2 parents baefabc + dab562e commit 8a9ccb1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ee/libcglue/src/ps2sdkapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ int __attribute__((weak)) _unlink(const char *path);
int __attribute__((weak)) mkdir(const char *path, mode_t mode);
int __attribute__((weak)) rmdir(const char *path);
int __attribute__((weak)) _stat(const char *path, struct stat *buf);
int __attribute__((weak)) _fstat(int fd, struct stat *buf);
int __attribute__((weak)) _close(int fd);
int __attribute__((weak)) _read(int fd, void *buf, size_t nbytes);
off_t __attribute__((weak)) _lseek(int fd, off_t offset, int whence);
Expand All @@ -471,7 +472,7 @@ void __fioOpsInitializeImpl(void)
// cppcheck-suppress knownConditionTrueFalse
if (&rmdir) __fio_fdman_path_ops.rmdir = fioRmdir;
// cppcheck-suppress knownConditionTrueFalse
if (&_stat) __fio_fdman_path_ops.stat = __fioGetstatHelper;
if ((&_stat) || (&_fstat)) __fio_fdman_path_ops.stat = __fioGetstatHelper;

memset(&__fio_fdman_ops_file, 0, sizeof(__fio_fdman_ops_file));
__fio_fdman_ops_file.getfd = __fioGetFdHelper;
Expand Down
3 changes: 2 additions & 1 deletion ee/rpc/filexio/src/fileXio_ps2sdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ int __attribute__((weak)) _rename(const char *old, const char *new);
int __attribute__((weak)) mkdir(const char *path, mode_t mode);
int __attribute__((weak)) rmdir(const char *path);
int __attribute__((weak)) _stat(const char *path, struct stat *buf);
int __attribute__((weak)) _fstat(int fd, struct stat *buf);
ssize_t __attribute__((weak)) readlink(const char *path, char *buf, size_t bufsiz);
int __attribute__((weak)) symlink(const char *target, const char *linkpath);
int __attribute__((weak)) _close(int fd);
Expand All @@ -482,7 +483,7 @@ extern void __fileXioOpsInitializeImpl(void)
// cppcheck-suppress knownConditionTrueFalse
if (&rmdir) __fileXio_fdman_path_ops.rmdir = fileXioRmdir;
// cppcheck-suppress knownConditionTrueFalse
if (&_stat) __fileXio_fdman_path_ops.stat = __fileXioGetstatHelper;
if ((&_stat) || (&_fstat)) __fileXio_fdman_path_ops.stat = __fileXioGetstatHelper;
// cppcheck-suppress knownConditionTrueFalse
if (&readlink) __fileXio_fdman_path_ops.readlink = fileXioReadlink;
// cppcheck-suppress knownConditionTrueFalse
Expand Down

0 comments on commit 8a9ccb1

Please sign in to comment.