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

[PATCH] Make sure the product.img directory is mounted before copying (#587696).



copyUpdatesImg and copyProductImg require that their argument be mounted and
accessible before the copy is performed.
---
 loader/nfsinstall.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/loader/nfsinstall.c b/loader/nfsinstall.c
index 660106a..09a2109 100644
--- a/loader/nfsinstall.c
+++ b/loader/nfsinstall.c
@@ -324,15 +324,22 @@ char * mountNfsImage(struct installMethod * method,
 
             free(buf);
 
-            checked_asprintf(&buf, "%s/updates.img", fullPath);
-            logMessage(INFO, "Looking for updates in %s", buf);
-            copyUpdatesImg(buf);
-            free(buf);
-
-            checked_asprintf(&buf, "%s/product.img", fullPath);
-            logMessage(INFO, "Looking for product in %s", buf);
-            copyProductImg(buf);
-            free(buf);
+            if (!doPwMount(fullPath, "/tmp/disk-image", "nfs", mountOpts, NULL)) {
+                logMessage(INFO, "Looking for updates in %s/updates.img", fullPath);
+                checked_asprintf(&buf, "/tmp/disk-image/updates.img");
+                copyUpdatesImg(buf);
+                free(buf);
+
+                logMessage(INFO, "Looking for product in %s/product.img", fullPath);
+                checked_asprintf(&buf, "/tmp/disk-image/product.img");
+                copyProductImg(buf);
+                free(buf);
+
+                umount("/tmp/disk-image");
+                unlink("/tmp/disk-image");
+            } else {
+                logMessage(INFO, "Couldn't mount %s for updates and product", fullPath);
+            }
 
             stage = NFS_STAGE_DONE;
             break;
-- 
1.7.0.1


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