vbox: shared folder read/write loop fix

Stop trying to read or write if the backend function reports that 0 bytes
have been read or written.

Fixes 
This commit is contained in:
Christian Prochaska 2015-07-09 14:57:01 +02:00 committed by Norman Feske
parent 8f4f1ae89c
commit 9d37510d1d
2 changed files with 27 additions and 23 deletions
repos/ports

@ -1 +1 @@
1722a638eb0095d736afffa29431c9c4da8f1d9b
166105c79c2ebd0d8378af72bb4c392595c7bd67

@ -1,7 +1,7 @@
sharedfolder_pagelist.patch
diff --git a/src/app/virtualbox/src/VBox/HostServices/SharedFolders/service.cpp b/src/app/virtualbox/src/VBox/HostServices/SharedFolders/service.cpp
index 49a0006..499d541 100644
index 49a0006..f9da046 100644
--- a/src/app/virtualbox/src/VBox/HostServices/SharedFolders/service.cpp
+++ b/src/app/virtualbox/src/VBox/HostServices/SharedFolders/service.cpp
@@ -549,6 +549,14 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32
@ -13,24 +13,28 @@ index 49a0006..499d541 100644
+ /* WORKAROUND start */
+ uint32_t read = 0;
+
+ while (paParms[3].u.uint32 && read < paParms[3].u.uint32) {
+ while (read < paParms[3].u.uint32) {
+
+
/* Execute the function. */
if (pStatusLed)
{
@@ -562,13 +570,25 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32
@@ -562,13 +570,27 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32
if (RT_SUCCESS(rc))
{
+ read += count;
- /* Update parameters.*/
- paParms[3].u.uint32 = count;
+ if (count == 0) {
+ /* Update parameters.*/
+ paParms[3].u.uint32 = read;
+ break;
+ }
+
+ read += count;
+ offset += count;
+ pBuffer += count;
+ count = paParms[3].u.uint32 - read;
+
/* Update parameters.*/
- paParms[3].u.uint32 = count;
+ //paParms[3].u.uint32 = count;
}
else
{
@ -41,40 +45,41 @@ index 49a0006..499d541 100644
+
+ } /* WORKAROUND - End */
+
+
+
}
}
break;
@@ -616,6 +636,16 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32
@@ -616,6 +638,14 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32
}
else
{
+
+
+
+ /* WORKAROUND start */
+ uint32_t write = 0;
+
+ while (paParms[3].u.uint32 && write < paParms[3].u.uint32) {
+ uint32_t written = 0;
+
+ while (written < paParms[3].u.uint32) {
+
+
/* Execute the function. */
if (pStatusLed)
{
@@ -629,13 +659,25 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32
@@ -629,13 +659,27 @@ static DECLCALLBACK(void) svcCall (void *, VBOXHGCMCALLHANDLE callHandle, uint32
if (RT_SUCCESS(rc))
{
+ write += count;
- /* Update parameters.*/
- paParms[3].u.uint32 = count;
+ if (count == 0) {
+ /* Update parameters.*/
+ paParms[3].u.uint32 = written;
+ break;
+ }
+
+ written += count;
+ offset += count;
+ pBuffer += count;
+ count = paParms[3].u.uint32 - write;
+
/* Update parameters.*/
- paParms[3].u.uint32 = count;
+ //paParms[3].u.uint32 = count;
+ count = paParms[3].u.uint32 - written;
}
else
{
@ -82,7 +87,6 @@ index 49a0006..499d541 100644
}
+
+
+
+ } /* WORKAROUND - End */
+
+