and following. This also fixes a small and very theoretical race: Between the fstat and the read call the file size might change. This would make us fail on potentially legitimate files.
This is more complex and probably slower, but looking at the use cases I don't think the speed matters.
ac487bf4d04 lib: Make fd_load work for non-regular files
lib/util/util_file.c | 63 +++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 48 insertions(+), 15 deletions(-)