diff options
Diffstat (limited to 'src/VBox/Main/src-client/GuestCtrlImplTasks.cpp')
-rw-r--r-- | src/VBox/Main/src-client/GuestCtrlImplTasks.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/VBox/Main/src-client/GuestCtrlImplTasks.cpp b/src/VBox/Main/src-client/GuestCtrlImplTasks.cpp index 8f12624dd..b026322b3 100644 --- a/src/VBox/Main/src-client/GuestCtrlImplTasks.cpp +++ b/src/VBox/Main/src-client/GuestCtrlImplTasks.cpp @@ -464,6 +464,8 @@ HRESULT Guest::taskCopyFileFromGuest(GuestTask *aTask) Guest::tr("Source file \"%s\" does not exist, or is not a file"), aTask->strSource.c_str()); } + else + rc = GuestTask::setProgressErrorInfo(rc, aTask->progress, pGuest); /* Query file size to make an estimate for our progress object. */ if (SUCCEEDED(rc)) @@ -538,7 +540,7 @@ HRESULT Guest::taskCopyFileFromGuest(GuestTask *aTask) RTFILE hFileDest; int vrc = RTFileOpen(&hFileDest, aTask->strDest.c_str(), - RTFILE_O_READWRITE | RTFILE_O_OPEN_CREATE | RTFILE_O_DENY_WRITE); + RTFILE_O_WRITE | RTFILE_O_OPEN_CREATE | RTFILE_O_DENY_WRITE); if (RT_FAILURE(vrc)) rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->progress, Guest::tr("Unable to create/open destination file \"%s\", rc=%Rrc"), @@ -557,10 +559,18 @@ HRESULT Guest::taskCopyFileFromGuest(GuestTask *aTask) { if (!aOutputData.size()) { - if (cbToRead) + /* + * Only bitch about an unexpected end of a file when there already + * was data read from that file. If this was the very first read we can + * be (almost) sure that this file is not meant to be read by the specified user. + */ + if ( cbTransfered + && cbToRead) + { rc = GuestTask::setProgressErrorInfo(VBOX_E_IPRT_ERROR, aTask->progress, - Guest::tr("Unexpected end of file \"%s\" (%u bytes left)"), - aTask->strSource.c_str(), cbToRead); + Guest::tr("Unexpected end of file \"%s\" (%u bytes left, %u bytes written)"), + aTask->strSource.c_str(), cbToRead, cbTransfered); + } break; } |