More complete support for fstab in dt

This commit is contained in:
topjohnwu
2020-05-03 22:49:54 -07:00
parent 8ab045331b
commit 0c99c4d93f
7 changed files with 151 additions and 116 deletions

View File

@@ -302,11 +302,10 @@ void full_read(const char *filename, void **buf, size_t *size) {
}
string fd_full_read(int fd) {
char buf[4096];
string str;
auto len = lseek(fd, 0, SEEK_END);
str.resize(len);
lseek(fd, 0, SEEK_SET);
xxread(fd, str.data(), len);
for (ssize_t len; (len = xread(fd, buf, sizeof(buf))) > 0;)
str.insert(str.end(), buf, buf + len);
return str;
}