This avoids potential use-after-move, since undefined c++ sequencing order may std::move(f) in the lambda capture before evaluating f.stat(). Also, this makes use of a more generic library function that doesn't require to open and hold on to the file in the application. Signed-off-by: Benny Halevy <bhalevy@scylladb.com> Message-Id: <20200514152054.162168-1-bhalevy@scylladb.com>