summaryrefslogtreecommitdiff
path: root/Applications
diff options
context:
space:
mode:
Diffstat (limited to 'Applications')
-rw-r--r--Applications/FileManager/FileUtils.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Applications/FileManager/FileUtils.cpp b/Applications/FileManager/FileUtils.cpp
index 20187415d7..7ba59f063b 100644
--- a/Applications/FileManager/FileUtils.cpp
+++ b/Applications/FileManager/FileUtils.cpp
@@ -26,6 +26,7 @@
#include "FileUtils.h"
#include <AK/LexicalPath.h>
+#include <AK/ScopeGuard.h>
#include <AK/StringBuilder.h>
#include <LibCore/DirIterator.h>
#include <stdio.h>
@@ -86,6 +87,8 @@ bool copy_file_or_directory(const String& src_path, const String& dst_path)
return false;
}
+ ScopeGuard close_fd_guard([src_fd]() { close(src_fd); });
+
struct stat src_stat;
int rc = fstat(src_fd, &src_stat);
if (rc < 0) {