lister::guarantee_type: do not follow symlink

Simliar to commit 9785754e0d
lister::guarantee_type needs to check the entry's type,
not the symlink it may point to.

Fixes #4606

The nodetool_refresh_with_wrong_upload_modes_test dtest creates a broken
symlink and following it fails, as it should, with the default follow_symlink::yes

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Message-Id: <20190626110734.4558-1-bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2019-06-26 14:07:34 +03:00
committed by Avi Kivity
parent 63edd46562
commit a0499bbd31

View File

@@ -42,7 +42,7 @@ future<directory_entry> lister::guarantee_type(directory_entry de) {
if (de.type) {
return make_ready_future<directory_entry>(std::move(de));
} else {
auto f = engine().file_type((_dir / de.name.c_str()).native());
auto f = engine().file_type((_dir / de.name.c_str()).native(), follow_symlink::no);
return f.then([dir = _dir, de = std::move(de)] (std::optional<directory_entry_type> t) mutable {
// If some FS error occures - return an exceptional future
if (!t) {