diff options
author | Andreas Kling <kling@serenityos.org> | 2021-04-21 22:16:32 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-21 23:49:01 +0200 |
commit | 2a6a54dea5d5711288de67f0081da312488039d9 (patch) | |
tree | d39b8d0c3b146d7494c68ae5712bd3fa5a667939 /Userland/Libraries/LibCore/FileWatcher.cpp | |
parent | b41b6dd279154a0873ce4c6a171fdd42fb827698 (diff) | |
download | serenity-2a6a54dea5d5711288de67f0081da312488039d9.zip |
Userland: Use Core::DirIterator::next_full_path()
Simplify some code by using this instead of concatenating the full path
ourselves at the call site.
Diffstat (limited to 'Userland/Libraries/LibCore/FileWatcher.cpp')
-rw-r--r-- | Userland/Libraries/LibCore/FileWatcher.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibCore/FileWatcher.cpp b/Userland/Libraries/LibCore/FileWatcher.cpp index 46db6686d6..3c990e8c9a 100644 --- a/Userland/Libraries/LibCore/FileWatcher.cpp +++ b/Userland/Libraries/LibCore/FileWatcher.cpp @@ -55,10 +55,10 @@ static String get_child_path_from_inode_index(const String& path, unsigned child } while (iterator.has_next()) { - auto child_full_path = String::formatted("{}/{}", path, iterator.next_path()); - struct stat st; + auto child_full_path = iterator.next_full_path(); - if (lstat(child_full_path.characters(), &st)) { + struct stat st = {}; + if (lstat(child_full_path.characters(), &st) < 0) { return {}; } |