mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
FileOperation: Don't follow symlinks
Deleting a symlink via "FileOperation Delete" should not recursively delete whatever the symlink is pointing to. Same basic idea applies to the Copy and Move operations.
This commit is contained in:
parent
8c9c2f46c7
commit
2c1788e2e4
Notes:
sideshowbarker
2024-07-18 07:14:25 +09:00
Author: https://github.com/awesomekling
Commit: 2c1788e2e4
1 changed files with 3 additions and 3 deletions
|
@ -76,7 +76,7 @@ static void report_warning(String message)
|
|||
static bool collect_copy_work_items(String const& source, String const& destination, Vector<WorkItem>& items)
|
||||
{
|
||||
struct stat st = {};
|
||||
if (stat(source.characters(), &st) < 0) {
|
||||
if (lstat(source.characters(), &st) < 0) {
|
||||
auto original_errno = errno;
|
||||
report_error(String::formatted("stat: {}", strerror(original_errno)));
|
||||
return false;
|
||||
|
@ -130,7 +130,7 @@ int perform_copy(Vector<String> const& sources, String const& destination)
|
|||
static bool collect_move_work_items(String const& source, String const& destination, Vector<WorkItem>& items)
|
||||
{
|
||||
struct stat st = {};
|
||||
if (stat(source.characters(), &st) < 0) {
|
||||
if (lstat(source.characters(), &st) < 0) {
|
||||
auto original_errno = errno;
|
||||
report_error(String::formatted("stat: {}", strerror(original_errno)));
|
||||
return false;
|
||||
|
@ -191,7 +191,7 @@ int perform_move(Vector<String> const& sources, String const& destination)
|
|||
static bool collect_delete_work_items(String const& source, Vector<WorkItem>& items)
|
||||
{
|
||||
struct stat st = {};
|
||||
if (stat(source.characters(), &st) < 0) {
|
||||
if (lstat(source.characters(), &st) < 0) {
|
||||
auto original_errno = errno;
|
||||
report_error(String::formatted("stat: {}", strerror(original_errno)));
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue