[winpr,path] fix NULL arguments for DeleteFile

This commit is contained in:
Armin Novak
2025-06-04 14:20:37 +02:00
committed by akallabeth
parent abbb998dca
commit b5b258c9f4
3 changed files with 8 additions and 10 deletions

View File

@@ -914,7 +914,7 @@ static BOOL shadow_server_init_certificate(rdpShadowServer* server)
if (!winpr_PathFileExists(filepath) && !winpr_PathMakePath(filepath, 0))
{
if (!CreateDirectoryA(filepath, 0))
if (!winpr_PathMakePath(filepath, NULL))
{
WLog_ERR(TAG, "Failed to create directory '%s'", filepath);
goto out_fail;

View File

@@ -760,11 +760,10 @@ BOOL winpr_DeleteFile(const char* lpFileName)
BOOL result = FALSE;
if (lpFileName)
{
lpFileNameW = ConvertUtf8ToWCharAlloc(lpFileName, NULL);
if (!lpFileNameW)
goto cleanup;
}
if (!lpFileNameW)
goto cleanup;
result = DeleteFileW(lpFileNameW);
@@ -783,11 +782,10 @@ BOOL winpr_RemoveDirectory(LPCSTR lpPathName)
BOOL result = FALSE;
if (lpPathName)
{
lpPathNameW = ConvertUtf8ToWCharAlloc(lpPathName, NULL);
if (!lpPathNameW)
goto cleanup;
}
if (!lpPathNameW)
goto cleanup;
result = RemoveDirectoryW(lpPathNameW);

View File

@@ -1102,7 +1102,7 @@ int makecert_context_process(MAKECERT_CONTEXT* context, int argc, char** argv)
{
if (!winpr_PathFileExists(context->output_path))
{
if (!CreateDirectoryA(context->output_path, NULL))
if (!winpr_PathMakePath(context->output_path, NULL))
return -1;
}