[PATCH phodav 10/13] spice-win: don't assign drive_letter on error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



drive_letter should be assigned only when the mapping was successful.

Signed-off-by: Jakub Janků <jjanku@xxxxxxxxxx>
---
 spice/spice-webdavd.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c
index 29058e7..f2c7f07 100644
--- a/spice/spice-webdavd.c
+++ b/spice/spice-webdavd.c
@@ -910,14 +910,20 @@ map_drive_cb(GTask *task,
           break;
         }
 
-      if (map_drive (drive_letter) != ERROR_ALREADY_ASSIGNED)
+      ret = map_drive (drive_letter);
+      if (ret == ERROR_ALREADY_ASSIGNED)
         {
-          break;
+          /* try again with another letter */
+          continue;
+        }
+      if (ret != NO_ERROR)
+        {
+          drive_letter = 0;
         }
+      break;
       //TODO: After mapping, rename network drive from \\localhost@PORT\DavWWWRoot
       //      to something like SPICE Shared Folder
     }
-
   g_mutex_lock(&map_drive_data->service_data->mutex);
   map_drive_data->service_data->drive_letter = drive_letter;
   g_mutex_unlock(&map_drive_data->service_data->mutex);
-- 
2.21.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]