fs_query: watch only readable files

The fs_query component used to try watching all files it found resulting in
errors on files that are not watchable. For some files, however, the watch-
feature doesn't make sense as they are not readable (no content, no size).
Now, fs_query will check first whether a file is readable and skip watching
if it isn't.

Ref #4032
This commit is contained in:
Martin Stein 2021-03-14 08:52:15 +01:00 committed by Christian Helmuth
parent 6e900f147c
commit 3ed26e7bb2

View File

@ -46,11 +46,16 @@ struct Fs_query::Watched_file
Node_rwx const _rwx;
Watcher _watcher;
Constructible<Watcher> _watcher { };
Watched_file(Directory const &dir, File_content::Path name, Node_rwx rwx,
Vfs::Watch_response_handler &handler)
: _name(name), _rwx(rwx), _watcher(dir, name, handler) { }
:
_name(name), _rwx(rwx)
{
if (_rwx.readable)
_watcher.construct(dir, name, handler);
}
virtual ~Watched_file() { }