Skip to content

util/os_file: always use the 'grow' mechanism

Eric Engestrom requested to merge eric/mesa:os-file-fix-race into master

Use fstat() only to pre-allocate a big enough buffer.

This fixes a race where if the file grows between fstat() and read() we would be missing the end of the file, and if the file slims down read() would just fail.

Fixes: 31696470 "util: add os_read_file() helper"


This fixes the issues spotted by @jekstrand in MR !72

Edited by Eric Engestrom

Merge request reports