@@ -538,20 +538,21 @@ static inline unsigned int _dev_minor(dev_t rdev) {
538
538
539
539
// There is no glibc statx() function, it must be called using syscall().
540
540
541
- static inline ssize_t
541
+ static inline int
542
542
_statx (int dfd , const char * filename , unsigned int flags , unsigned int mask , struct statx * buffer ) {
543
- return syscall (__NR_statx , dfd , filename , flags , mask , buffer );
543
+ int ret = syscall (__NR_statx , dfd , filename , flags , mask , buffer );
544
+ return ret == 0 ? ret : errno ;
544
545
}
545
546
546
547
// At the moment the only extra information statx() is used for is to get the btime (file creation time).
547
548
// This function is here instead of in FileManager.swift because there is no way of setting a conditional
548
549
// define that could be used with a #if in the Swift code.
549
- static inline ssize_t
550
+ static inline int
550
551
_stat_with_btime (const char * filename , struct stat * buffer , struct timespec * btime ) {
551
552
struct statx statx_buffer = {0 };
552
553
* btime = (struct timespec ) {0 };
553
554
554
- ssize_t ret = _statx (AT_FDCWD , filename , AT_SYMLINK_NOFOLLOW | AT_STATX_SYNC_AS_STAT , STATX_ALL , & statx_buffer );
555
+ int ret = _statx (AT_FDCWD , filename , AT_SYMLINK_NOFOLLOW | AT_STATX_SYNC_AS_STAT , STATX_ALL , & statx_buffer );
555
556
if (ret == 0 ) {
556
557
* buffer = (struct stat ) {
557
558
.st_dev = makedev (statx_buffer .stx_dev_major , statx_buffer .stx_dev_minor ),
@@ -587,10 +588,10 @@ _stat_with_btime(const char *filename, struct stat *buffer, struct timespec *bti
587
588
588
589
// Dummy version when compiled where struct statx is not defined in the headers.
589
590
// Just calles lstat() instead.
590
- static inline ssize_t
591
+ static inline int
591
592
_stat_with_btime (const char * filename , struct stat * buffer , struct timespec * btime ) {
592
593
* btime = (struct timespec ) {0 };
593
- return lstat (filename , buffer );
594
+ return lstat (filename , buffer ) == 0 ? 0 : errno ;
594
595
}
595
596
#endif // __NR_statx
596
597
0 commit comments