Index: trunk/ippTools/src/stacktool.c
===================================================================
--- trunk/ippTools/src/stacktool.c	(revision 12052)
+++ trunk/ippTools/src/stacktool.c	(revision 12054)
@@ -295,5 +295,5 @@
     // XXX instead of validiting it here we should just use forgein key
     // constrants
-    if (!stackInputSkyfileInsert(config->dbh, 
+    if (!stackInputSkyfileInsert(config->dbh,
             (psS32)atoi(stack_id),
             (psS32)atoi(warp_id)
@@ -319,5 +319,5 @@
 
     // find all rawImfiles matching the default query
-    psString query = psStringCopy( 
+    psString query = psStringCopy(
         "SELECT\n"
         "   warpSkyfile.*\n"
@@ -330,5 +330,5 @@
         "   AND stackRun.tess_id       = warpSkyfile.tess_id\n"
         " WHERE\n"
-        "   stackRun.state = 'run'\n" 
+        "   stackRun.state = 'run'\n"
     );
     if (config->where) {
@@ -409,5 +409,5 @@
 
     // find all rawImfiles matching the default query
-    psString query = psStringCopy( 
+    psString query = psStringCopy(
         "SELECT\n"
         "   stackRun.stack_id\n"
@@ -416,5 +416,5 @@
         "   USING(stack_id)\n"
         " WHERE\n"
-        "   stackRun.state = 'run'\n" 
+        "   stackRun.state = 'run'\n"
         "   AND stackSumSkyfile.stack_id IS NULL\n"
     );
@@ -532,5 +532,5 @@
     // XXX instead of validiting it here we should just use forgein key
     // constrants
-    if (!stackSumSkyfileInsert(config->dbh, 
+    if (!stackSumSkyfileInsert(config->dbh,
             (psS32)atoi(stack_id),
             uri,
@@ -545,5 +545,5 @@
     }
 
-    if (setstackRunState(config, stack_id, "stop")) {
+    if (!setstackRunState(config, stack_id, "stop")) {
         if (!psDBRollback(config->dbh)) {
             psError(PS_ERR_UNKNOWN, false, "database error");
@@ -575,5 +575,5 @@
 
     // find all rawImfiles matching the default query
-    psString query = psStringCopy( 
+    psString query = psStringCopy(
         "SELECT\n"
         "   stackSumSkyfile.*\n"
@@ -582,5 +582,5 @@
         "   USING(stack_id)\n"
         " WHERE\n"
-        "   stackRun.state = 'run'\n" 
+        "   stackRun.state = 'run'\n"
     );
 
