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

[win-pv-devel] [PATCH] Handle lack of IPv6 registry keys in co-installer



The co-installer attempts to copy IPv6 address information from the any
relevant emulated device to the PV device during installation, but will fail
if no IPv6 address information is present. This is not an error condition and
so the co-installer should simply skip this copying operation if no address
information is found.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/coinst/coinst.c | 55 ++++++++++++++++++++++++++++-------------------------
 1 file changed, 29 insertions(+), 26 deletions(-)

diff --git a/src/coinst/coinst.c b/src/coinst/coinst.c
index 450dc5f..532a382 100644
--- a/src/coinst/coinst.c
+++ b/src/coinst/coinst.c
@@ -1218,6 +1218,16 @@ CopyValues(
     Log("DESTINATION: %s", DestinationKeyName);
     Log("SOURCE: %s", SourceKeyName);
 
+    Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+                         SourceKeyName,
+                         0,
+                         KEY_ALL_ACCESS,
+                         &SourceKey);
+    if (Error != ERROR_SUCCESS) {
+        SetLastError(Error);
+        goto fail1;
+    }
+    
     Error = RegCreateKeyEx(HKEY_LOCAL_MACHINE,
                            DestinationKeyName,
                            0,
@@ -1229,23 +1239,13 @@ CopyValues(
                            NULL);
     if (Error != ERROR_SUCCESS) {
         SetLastError(Error);
-        goto fail1;
-    }
-
-    Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
-                         SourceKeyName,
-                         0,
-                         KEY_ALL_ACCESS,
-                         &SourceKey);
-    if (Error != ERROR_SUCCESS) {
-        SetLastError(Error);
         goto fail2;
     }
-    
+
     CopyKeyValues(DestinationKey, SourceKey);
 
-    RegCloseKey(SourceKey);
     RegCloseKey(DestinationKey);
+    RegCloseKey(SourceKey);
 
     Log("<====");
 
@@ -1254,7 +1254,7 @@ CopyValues(
 fail2:
     Log("fail2");
 
-    RegCloseKey(DestinationKey);
+    RegCloseKey(SourceKey);
 
 fail1:
     Error = GetLastError();
@@ -1379,6 +1379,19 @@ CopyIpVersion6Addresses(
     Log("DESTINATION: %s\\%s", DestinationKeyName, DestinationValueName);
     Log("SOURCE: %s\\%s", SourceKeyName, SourceValueName);
 
+    Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+                         SourceKeyName,
+                         0,
+                         KEY_ALL_ACCESS,
+                         &SourceKey);
+    if (Error != ERROR_SUCCESS) {
+        if (Error == ERROR_FILE_NOT_FOUND)
+            goto done;
+
+        SetLastError(Error);
+        goto fail1;
+    }
+
     Error = RegCreateKeyEx(HKEY_LOCAL_MACHINE,
                            DestinationKeyName,
                            0,
@@ -1390,16 +1403,6 @@ CopyIpVersion6Addresses(
                            NULL);
     if (Error != ERROR_SUCCESS) {
         SetLastError(Error);
-        goto fail1;
-    }
-
-    Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
-                         SourceKeyName,
-                         0,
-                         KEY_ALL_ACCESS,
-                         &SourceKey);
-    if (Error != ERROR_SUCCESS) {
-        SetLastError(Error);
         goto fail2;
     }
 
@@ -1483,8 +1486,8 @@ CopyIpVersion6Addresses(
     free(Value);
     free(Name);
 
-    RegCloseKey(SourceKey);
     RegCloseKey(DestinationKey);
+    RegCloseKey(SourceKey);
 
 done:
 
@@ -1509,12 +1512,12 @@ fail4:
 fail3:
     Log("fail3");
 
-    RegCloseKey(SourceKey);
+    RegCloseKey(DestinationKey);
 
 fail2:
     Log("fail2");
 
-    RegCloseKey(DestinationKey);
+    RegCloseKey(SourceKey);
 
 fail1:
     Error = GetLastError();
-- 
2.1.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.