Index: /trunk/ippTools/src/warptool.c
===================================================================
--- /trunk/ippTools/src/warptool.c	(revision 11851)
+++ /trunk/ippTools/src/warptool.c	(revision 11852)
@@ -59,4 +59,8 @@
 
     pxConfig *config = p4toolConfig(NULL, argc, argv);
+    if (!config) {
+        psError(PXTOOLS_ERR_CONFIG, false, "failed to configure");
+        goto FAIL;
+    }
 
     switch (config->mode) {
@@ -84,4 +88,5 @@
 FAIL:
     psErrorStackPrint(stderr, "\n");
+    int exit_status = pxerrorGetExitStatus();
 
     psFree(config);
@@ -89,5 +94,5 @@
     psLibFinalize();
 
-    exit(EXIT_FAILURE);
+    exit(exit_status);
 }
 
Index: /trunk/ippTools/src/warptoolConfig.c
===================================================================
--- /trunk/ippTools/src/warptoolConfig.c	(revision 11851)
+++ /trunk/ippTools/src/warptoolConfig.c	(revision 11852)
@@ -27,5 +27,4 @@
 #include "p4tool.h"
 
-// this function can not fail -- exits on error
 pxConfig *p4toolConfig(pxConfig *config, int argc, char **argv) {
     if (!config) {
@@ -39,5 +38,6 @@
     if (!config->modules) {
         psError(PS_ERR_UNKNOWN, false, "Can't find site configuration");
-        goto FAIL;
+        psFree(config);
+        return NULL;
     }
 
@@ -188,5 +188,6 @@
         if (config->mode) { \
             psError(PS_ERR_UNKNOWN, true, "only one mode selection is allowed"); \
-            goto FAIL; \
+            psFree(config); \
+            return NULL; \
         } \
         config->mode = modeval; \
@@ -248,5 +249,6 @@
 
         psFree(argSets);
-        goto FAIL;
+        psFree(config);
+        return NULL;
     }
 
@@ -261,5 +263,6 @@
         if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\
             psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
-            goto FAIL; \
+            psFree(config); \
+            return NULL; \
         } \
     } \
@@ -273,5 +276,6 @@
         if (!psMetadataAddS32(config->where, PS_LIST_TAIL, #name, 0, "==", s32)) { \
             psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
-            goto FAIL; \
+            psFree(config); \
+            return NULL; \
         } \
     } \
@@ -288,5 +292,6 @@
         if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "p4_id", 0, "==", (psS32)atoi(str))) {
             psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");
-            goto FAIL; 
+            psFree(config);
+            return NULL;
         } 
     } 
@@ -307,5 +312,6 @@
     if (!config->dbh) {
         psError(PS_ERR_UNKNOWN, false, "Can't configure database");
-        goto FAIL;
+        psFree(config);
+        return NULL;
     }
 
@@ -315,9 +321,3 @@
 
     return config;
-
-FAIL:
-    psFree(config);
-    pmConfigDone();
-    psLibFinalize();
-    exit(EXIT_FAILURE);
-}
+}
