std: Don't trust stat() size in readAllAlloc fns
Some files such as the ones in /proc report a st_size of zero, try to read the file anyway if we hit that case.
This commit is contained in:
@@ -1454,9 +1454,7 @@ pub const Dir = struct {
|
||||
var file = try self.openFile(file_path, .{});
|
||||
defer file.close();
|
||||
|
||||
const stat_size = try file.getEndPos();
|
||||
|
||||
return file.readAllAllocOptions(allocator, stat_size, max_bytes, alignment, optional_sentinel);
|
||||
return file.readAllAllocOptions(allocator, max_bytes, alignment, optional_sentinel);
|
||||
}
|
||||
|
||||
pub const DeleteTreeError = error{
|
||||
|
||||
Reference in New Issue
Block a user