Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-30955 Fix recursiveRemoveDirectory errors handling soft links #18109

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion system/jlib/jfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4256,8 +4256,20 @@ void recursiveRemoveDirectory(IFile *dir)
recursiveRemoveDirectory(thisFile);
else
{
try
{
thisFile->remove();
continue; // i.e. continue if returns true (removed), or false (file no longer exists)
}
catch(IException *e)
{
e->Release();
}

// NB: not sure this is worth it. In linux the file can be read-only and still be deleted if the directory is writable
// Perhaps should ensure that the parent directory is writable, but that would require extra file ops. or interface changes
thisFile->setReadOnly(false);
thisFile->remove();
thisFile->remove(); // if gets here, the file should exist (ignore return false if doesn't), throws an exception if fails for other reason
}
}
dir->remove();
Expand Down
Loading