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

[win-pv-devel] [PATCH 6/6] Add option to not spawn child process.



From: Owen Smith <owen.smith@xxxxxxxxxx>

If the "Executable" registry parameter is not found, do not spawn
a child process instead of failing.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/monitor/monitor.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 6e1e85f..57513ff 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -597,6 +597,10 @@ MonitorThread(
 
     Log("====>");
 
+    // If there is no executable, this thread can finish now.
+    if (Context->Executable == NULL)
+        goto done;
+
 again:
     ZeroMemory(&ProcessInfo, sizeof (ProcessInfo));
     ZeroMemory(&StartupInfo, sizeof (StartupInfo));
@@ -649,6 +653,7 @@ again:
 
 //#undef WAIT_OBJECT_1
 
+done:
     Log("<====");
 
     return 0;
@@ -1272,7 +1277,7 @@ MonitorMain(
 
     Success = GetExecutable(&Context->Executable);
     if (!Success)
-        goto fail7;
+        Context->Executable = NULL;
 
     Context->Device = INVALID_HANDLE_VALUE;
 
@@ -1286,7 +1291,7 @@ MonitorMain(
                                    &Interface,
                                    DEVICE_NOTIFY_SERVICE_HANDLE);
     if (Context->InterfaceNotification == NULL)
-        goto fail8;
+        goto fail7;
 
     // The device may already by present
     SetEvent(Context->AddEvent);
@@ -1338,7 +1343,8 @@ done:
 
     UnregisterDeviceNotification(Context->InterfaceNotification);
 
-    free(Context->Executable);
+    if (Context->Executable)
+        free(Context->Executable);
 
     CloseHandle(Context->RemoveEvent);
 
@@ -1356,11 +1362,6 @@ done:
 
     return;
 
-fail8:
-    Log("fail8");
-
-    free(Context->Executable);
-
 fail7:
     Log("fail7");
 
-- 
2.8.3


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://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®.