Skip to content

Commit ce69e3a

Browse files
authored
Merge pull request #5263 from tamasvajk/feature/fix-file-move
C#: Fix potentially concurrent file moves
2 parents 8241a9c + a5543c6 commit ce69e3a

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

csharp/extractor/Semmle.Util/FileUtils.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ public static string ConvertToNative(string path)
3333
/// <param name="dest">Target file.</param>
3434
public static void MoveOrReplace(string src, string dest)
3535
{
36-
// Potential race condition here.
37-
// .net offers the facility to either move a file, or to replace it.
38-
File.Delete(dest);
39-
File.Move(src, dest);
36+
File.Move(src, dest, overwrite: true);
4037
}
4138

4239
/// <summary>

0 commit comments

Comments
 (0)