gtx: Return failure if gtx_Init can't start thread
authorSimon Wilkinson <sxw@your-file-system.com>
Fri, 22 Feb 2013 10:35:48 +0000 (10:35 +0000)
committerJeffrey Altman <jaltman@your-file-system.com>
Sun, 24 Feb 2013 19:33:08 +0000 (11:33 -0800)
If LWP_CreateProcess fails in gtx_Init return NULL, rather than
silently swallowing the failure.

Caught by clang-analyzer

Change-Id: I5db5667f9dae3f405e88cf9c57e6b8a069ea28a3
Reviewed-on: http://gerrit.openafs.org/9236
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/gtx/input.c

index 932ce85..f7303f6 100644 (file)
@@ -92,10 +92,13 @@ gtx_Init(int astartInput,
 
     /* if we start input thread */
     IOMGR_Initialize();                /* input thread uses it */
-    if (astartInput)
-       code =
-           LWP_CreateProcess(gtx_InputServer, 8192, LWP_NORMAL_PRIORITY,
-                             (void *)0, "gx-listener", &junk);
+    if (astartInput) {
+       code = LWP_CreateProcess(gtx_InputServer, 8192, LWP_NORMAL_PRIORITY,
+                                NULL, "gx-listener", &junk);
+       if (code)
+           return NULL;
+    }
+
     /* all done */
     twin = &gator_basegwin;
     return twin;