[or-cvs] r19167: {torvm} I dont think anyone uses the vm no-op mode, but if they do m (torvm/trunk/build/win32/src/torvm-w32)

coderman at seul.org coderman at seul.org
Fri Mar 27 19:55:43 UTC 2009


Author: coderman
Date: 2009-03-27 15:55:43 -0400 (Fri, 27 Mar 2009)
New Revision: 19167

Modified:
   torvm/trunk/build/win32/src/torvm-w32/torvm.c
Log:
I dont think anyone uses the vm no-op mode, but if they do make sure we dont crash.

Modified: torvm/trunk/build/win32/src/torvm-w32/torvm.c
===================================================================
--- torvm/trunk/build/win32/src/torvm-w32/torvm.c	2009-03-27 18:53:05 UTC (rev 19166)
+++ torvm/trunk/build/win32/src/torvm-w32/torvm.c	2009-03-27 19:55:43 UTC (rev 19167)
@@ -1722,7 +1722,7 @@
   TCHAR *cmd = malloc(CMDMAX);
   /* TODO: clean this up once the msys path munging works.  kernel and hdd need to be unixy paths */
   snprintf (cmd, CMDMAX -1,
-            "\"%s\" -L . -no-reboot -kernel ../lib/vmlinuz -hda ../state/hdd.img -m %d -std-vga", qemubin, QEMU_DEF_MEM);
+            "\"%s\" -L . -no-reboot -kernel ../lib/vmlinuz -append \"loglevel=9 NOINIT\" -hda ../state/hdd.img -m %d -std-vga", qemubin, QEMU_DEF_MEM);
   ldebug ("Launching Qemu with cmd: %s", cmd);
   if( !CreateProcess(NULL,
                      cmd,
@@ -1781,9 +1781,9 @@
     goto cleanup;
   } 
   if (!buildsyspath(SYSDIR_LCLDATA, "Polipo\\save-cfg.txt", &pcfgdestsave)) {
-    lerror ("Unable to build path for polipo saved dest config."); 
+    lerror ("Unable to build path for polipo saved dest config.");
     goto cleanup;
-  } 
+  }
   if (!buildsyspath(SYSDIR_LCLPROGRAMS, "Vidalia\\vidalia-marble.exe", &exe)) {
     lerror ("Unable to build path for vidalia marble exe."); 
     goto cleanup;
@@ -1811,7 +1811,7 @@
     ldebug ("Copying default polipo config from %s to save-file %s", pcfgtmp, pcfgdestsave);
     copyfile(pcfgtmp, pcfgdestsave);
   }
-  
+
   cmd = malloc(CMDMAX);
   snprintf (cmd, CMDMAX -1,
             "\"%s\" -tor-address %s%s",
@@ -1852,6 +1852,8 @@
     free(vcfgdest);
   if(pcfgdest)
     free(pcfgdest);
+  if(pcfgdestsave)
+    free(pcfgdestsave);
 
   return retval;
 }
@@ -2389,27 +2391,27 @@
       lerror ("Unable to generate command line for kernel.");
       goto shutdown;
     }
+    ldebug ("Generated kernel command line: %s", cmdline);
   }
 
-  ldebug ("Generated kernel command line: %s", cmdline);
-
   PROCESS_INFORMATION pi;
-  if (!vmnop) {
-    if (! launchtorvm(&pi,
-                      ce->guid,
-                      ce->macaddr,
-                      TOR_TAP_NAME,
-                      cmdline)) {
-      lerror ("Unable to launch Qemu TorVM instance.");
-      goto shutdown;
-    }
-  }
-  else {
+  if (vmnop) {
     if (! spawnprocess(&pi, "qemu.exe")) {
       lerror ("Unable to launch default Qemu instance.");
-      goto shutdown;
     }
+    /* This mode does nothing but run Qemu with the kernel and virtual disk.
+     * no need for cleanup or interface configuration.
+     */
+    exit (0);
   }
+  if (! launchtorvm(&pi,
+                    ce->guid,
+                    ce->macaddr,
+                    TOR_TAP_NAME,
+                    cmdline)) {
+    lerror ("Unable to launch Qemu TorVM instance.");
+    goto shutdown;
+  }
 
   /* need to delay long enough to allow qemu to start and open tap device */
   if (tapconn) {



More information about the tor-commits mailing list