]> xenbits.xensource.com Git - people/pauldu/xennet.git/commitdiff
Handle lack of IPv6 registry keys in co-installer
authorPaul Durrant <paul.durrant@citrix.com>
Tue, 7 Oct 2014 09:23:48 +0000 (10:23 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Tue, 7 Oct 2014 09:23:48 +0000 (10:23 +0100)
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@citrix.com>
src/coinst/coinst.c

index 450dc5fd8404a6cd1e6775c1ceb6bd8a62898ebc..532a382455a0abb71bd55a97729fa18147a6d7c5 100644 (file)
@@ -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,
@@ -1227,25 +1237,15 @@ CopyValues(
                            NULL,
                            &DestinationKey,
                            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,
@@ -1388,16 +1401,6 @@ CopyIpVersion6Addresses(
                            NULL,
                            &DestinationKey,
                            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();