From 61f30484b6937a1a3cd085901a7c91eb34d5fa69 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 1 Jun 2025 20:26:21 +0300 Subject: more logs for PU --- plugins/PluginUpdater/src/unzipfile.cpp | 3 ++- src/mir_app/src/pu_utils.cpp | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/plugins/PluginUpdater/src/unzipfile.cpp b/plugins/PluginUpdater/src/unzipfile.cpp index 386c1265e2..2c661758fb 100644 --- a/plugins/PluginUpdater/src/unzipfile.cpp +++ b/plugins/PluginUpdater/src/unzipfile.cpp @@ -125,7 +125,8 @@ int extractCurrentFile(unzFile uf, wchar_t *pwszDestPath, wchar_t *pwszBackPath, while (true) { err = unzReadCurrentFile(uf, buf, DATA_BUF_SIZE); if (err <= 0) { - Netlib_LogfW(g_hNetlibUser, L"Error reading zipped file %s: %d", pwszFile2unzip, err); + if (err) + Netlib_LogfW(g_hNetlibUser, L"Error reading zipped file %s: %d", pwszFile2unzip, err); break; } diff --git a/src/mir_app/src/pu_utils.cpp b/src/mir_app/src/pu_utils.cpp index 0c7f379d0a..019b9136d7 100644 --- a/src/mir_app/src/pu_utils.cpp +++ b/src/mir_app/src/pu_utils.cpp @@ -247,8 +247,10 @@ MIR_APP_DLL(int) PU::SafeMoveFile(const wchar_t *pSrc, const wchar_t *pDst) if (g_hPipe == nullptr) { if (!DeleteFileW(pDst)) { uint32_t dwError = GetLastError(); - if (dwError != ERROR_ACCESS_DENIED && dwError != ERROR_FILE_NOT_FOUND) + if (dwError != ERROR_ACCESS_DENIED && dwError != ERROR_FILE_NOT_FOUND) { + Netlib_LogfW(0, L"Unable to delete dest file %s during move, error %d", pDst, dwError); return dwError; + } } if (!MoveFileW(pSrc, pDst)) { // use copy on error @@ -262,11 +264,17 @@ MIR_APP_DLL(int) PU::SafeMoveFile(const wchar_t *pSrc, const wchar_t *pDst) case ERROR_LOCK_VIOLATION: // use copy routine if a move operation isn't available // for example, when files are on different disks - if (!CopyFileW(pSrc, pDst, FALSE)) - return GetLastError(); - - if (!DeleteFileW(pSrc)) - return GetLastError(); + if (!CopyFileW(pSrc, pDst, FALSE)) { + dwError = GetLastError(); + Netlib_LogfW(0, L"Unable to copy file %s to %s during move, error %d", pSrc, pDst, dwError); + return dwError; + } + + if (!DeleteFileW(pSrc)) { + dwError = GetLastError(); + Netlib_LogfW(0, L"Unable to delete source file %s during move, error %d", pSrc, dwError); + return dwError; + } break; default: -- cgit v1.2.3