mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-06-12 21:27:41 +02:00
Better error handling and logging
This commit is contained in:
@ -273,10 +273,17 @@ void fclone_attr(int src, int dest) {
|
||||
}
|
||||
|
||||
void *__mmap(const char *filename, size_t *size, bool rw) {
|
||||
int fd = xopen(filename, (rw ? O_RDWR : O_RDONLY) | O_CLOEXEC);
|
||||
if (fd < 0) {
|
||||
*size = 0;
|
||||
return nullptr;
|
||||
}
|
||||
struct stat st;
|
||||
void *buf;
|
||||
int fd = xopen(filename, (rw ? O_RDWR : O_RDONLY) | O_CLOEXEC);
|
||||
fstat(fd, &st);
|
||||
if (fstat(fd, &st)) {
|
||||
*size = 0;
|
||||
return nullptr;
|
||||
}
|
||||
if (S_ISBLK(st.st_mode))
|
||||
ioctl(fd, BLKGETSIZE64, size);
|
||||
else
|
||||
|
Reference in New Issue
Block a user