lib: Make fd_load work for non-regular files
authorVolker Lendecke <vl@samba.org>
Thu, 21 Feb 2019 17:37:08 +0000 (18:37 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 26 Mar 2019 04:43:40 +0000 (04:43 +0000)
commitac487bf4d04c9771ada1ca7eeb9dac4e5fe34185
treee93ad05712ab18980a433e921689f0074f9a1956
parent5c6fdb5dc741702b626099e53b5d4a01e673241e
lib: Make fd_load work for non-regular files

Follow-up to

https://lists.samba.org/archive/samba/2018-September/217992.html

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.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13859

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Mar 26 04:43:40 UTC 2019 on sn-devel-144
lib/util/util_file.c