From e7f102bdee161d5dd9b0f8a0a207d82af7061d34 Mon Sep 17 00:00:00 2001 From: David Refoua Date: Thu, 6 Nov 2025 17:09:40 +0330 Subject: [PATCH] avoid temp filename collisions --- vendor/lib/lib_path.cmd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vendor/lib/lib_path.cmd b/vendor/lib/lib_path.cmd index 0c46587..8202b03 100644 --- a/vendor/lib/lib_path.cmd +++ b/vendor/lib/lib_path.cmd @@ -128,8 +128,14 @@ exit /b :toolong set "_rand=%RANDOM%" + if exist "%temp%\%_rand%_cmder_lib_pathA" del "%temp%\%_rand%_cmder_lib_pathA" 2>nul 1>nul + if exist "%temp%\%_rand%_cmder_lib_pathB" del "%temp%\%_rand%_cmder_lib_pathB" 2>nul 1>nul + if exist "%temp%\%_rand%_cmder_lib_pathA" goto :toolong + if exist "%temp%\%_rand%_cmder_lib_pathB" goto :toolong echo "%OLD_PATH%">"%temp%\%_rand%_cmder_lib_pathA" + if errorlevel 1 ( if exist "%temp%\%_rand%_cmder_lib_pathA" del "%temp%\%_rand%_cmder_lib_pathA" & goto :toolong ) echo "%PATH%">"%temp%\%_rand%_cmder_lib_pathB" + if errorlevel 1 ( if exist "%temp%\%_rand%_cmder_lib_pathA" del "%temp%\%_rand%_cmder_lib_pathA" & if exist "%temp%\%_cmder_lib_pathB" del "%temp%\%_rand%_cmder_lib_pathB" & goto :toolong ) fc /b "%temp%\%_rand%_cmder_lib_pathA" "%temp%\%_rand%_cmder_lib_pathB" 2>nul 1>nul if errorlevel 1 ( del "%temp%\%_rand%_cmder_lib_pathA" & del "%temp%\%_rand%_cmder_lib_pathB" & set "_rand=" & goto :changed ) del "%temp%\%_rand%_cmder_lib_pathA" & del "%temp%\%_rand%_cmder_lib_pathB" & set "_rand="