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)
committerKarolin Seeger <kseeger@samba.org>
Tue, 2 Apr 2019 09:10:56 +0000 (09:10 +0000)
commit815be52b60026f9101a66ed8b276a581ec83df7d
tree431f151a7252757591c4580910e495eef748e3a7
parente769bd6608951e80bcc3fac7b4808194f22bbd36
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

(cherry picked from commit ac487bf4d04c9771ada1ca7eeb9dac4e5fe34185)
lib/util/util_file.c