mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-05-07 22:36:47 +00:00
parent
d8cd2031c7
commit
dee3c3e7ba
@ -358,9 +358,13 @@ void full_read_at(int dirfd, const char *filename, void **buf, size_t *size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void write_zero(int fd, size_t size) {
|
void write_zero(int fd, size_t size) {
|
||||||
size_t pos = lseek(fd, 0, SEEK_CUR);
|
char buf[4096] = {0};
|
||||||
ftruncate(fd, pos + size);
|
size_t len;
|
||||||
lseek(fd, pos + size, SEEK_SET);
|
while (size > 0) {
|
||||||
|
len = sizeof(buf) > size ? size : sizeof(buf);
|
||||||
|
write(fd, buf, len);
|
||||||
|
size -= len;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void file_readline(const char *filename, const function<bool (string_view&)> &fn, bool trim) {
|
void file_readline(const char *filename, const function<bool (string_view&)> &fn, bool trim) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user