diff --git a/Telegram/SourceFiles/_other/updater_linux.cpp b/Telegram/SourceFiles/_other/updater_linux.cpp index 911dab048d..1a634adeb5 100644 --- a/Telegram/SourceFiles/_other/updater_linux.cpp +++ b/Telegram/SourceFiles/_other/updater_linux.cpp @@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include #include +#include #include #include #include @@ -113,11 +114,23 @@ bool copyFile(const char *from, const char *to) { fst.st_size); if (copied == -1) { + writeLog( + "Copy by sendfile '%s' to '%s' failed, error: %d, fallback now.", + from, + to, + int(errno)); static const int BufSize = 65536; char buf[BufSize]; while (size_t size = fread(buf, 1, BufSize, ffrom)) { fwrite(buf, 1, size, fto); } + } else { + writeLog( + "Copy by sendfile '%s' to '%s' done, size: %d, result: %d.", + from, + to, + int(fst.st_size), + int(copied)); } //update to the same uid/gid diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 43e523f599..3baf7c1dcb 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -52,6 +52,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include +#include #include #include #include @@ -1039,13 +1040,25 @@ bool linuxMoveFile(const char *from, const char *to) { nullptr, fst.st_size); #endif // Q_OS_LINUX - + if (copied == -1) { + DEBUG_LOG(("Update Error: " + "Copy by sendfile '%1' to '%2' failed, error: %3, fallback now." + ).arg(from + ).arg(to + ).arg(errno)); static const int BufSize = 65536; char buf[BufSize]; while (size_t size = fread(buf, 1, BufSize, ffrom)) { fwrite(buf, 1, size, fto); } + } else { + DEBUG_LOG(("Update Info: " + "Copy by sendfile '%1' to '%2' done, size: %3, result: %4." + ).arg(from + ).arg(to + ).arg(fst.st_size + ).arg(copied)); } //update to the same uid/gid