Index: src/hg/trfBig/trfBig.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/trfBig/trfBig.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -b -B -U 4 -r1.18 -r1.19
--- src/hg/trfBig/trfBig.c	2 Nov 2009 21:27:50 -0000	1.18
+++ src/hg/trfBig/trfBig.c	24 Dec 2009 03:59:38 -0000	1.19
@@ -100,12 +100,24 @@
 void trfSysCall(char *faFile)
 /* Invoke trf program on file. */
 {
 char command[1024];
-sprintf(command, "cd %s; %s %s 2 7 7 80 10 50 %d -m %s", 
+safef(command, sizeof(command), "cd %s; %s %s 2 7 7 80 10 50 %d -m %s", 
 	tempDir, trfExe, faFile, maxPeriod, doBed ? "-d" : "");
 uglyf("faFile %s, command %s\n", faFile, command);
-maybeSystem(command);
+
+/* Run the system command, expecting a return code of 1, as trf
+   returns the number of successfully processed sequences. */
+int status = system(command);
+if (WIFSIGNALED(status))
+    errAbort("Command terminated by signal %d: %s", WTERMSIG(status), command);
+else if (WIFEXITED(status))
+    {
+    if (WEXITSTATUS(status) != 1)
+        errAbort("Command exited with status %d (expected 1): %s", WEXITSTATUS(status), command);
+    }
+else
+    errAbort("Unexpected exit for command: %s", command);
 }
 
 void outputWithBreaks(FILE *out, char *s, int size, int lineSize)
 /* Print s of given size to file, adding line feeds every now and then. */

