[phodav: 11/14] spice-win: don't assign drive_letter on error



commit 2bd9e2ee81a633b06aa3b522c1ebc60a3a292f87
Author: Jakub Janků <jjanku redhat com>
Date:   Thu May 16 13:10:30 2019 +0200

    spice-win: don't assign drive_letter on error
    
    drive_letter should be assigned only when the mapping was successful.
    
    Signed-off-by: Jakub Janků <jjanku redhat com>

 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 18b1c9d..61a3cc7 100644
--- a/spice/spice-webdavd.c
+++ b/spice/spice-webdavd.c
@@ -919,14 +919,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);


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