aboutsummaryrefslogtreecommitdiff
path: root/pan
diff options
context:
space:
mode:
authoryaberauneya <yaberauneya>2009-10-15 18:45:55 +0000
committeryaberauneya <yaberauneya>2009-10-15 18:45:55 +0000
commit2b6cd80e5a3e207b519c2301375081f3e2e8a467 (patch)
treea7b98811d4984d863a0617d4a66a8488d7f640b0 /pan
parent3a9947e7d1ff309784192ac30e556f2935e2a1f9 (diff)
While trying to figure out why entries don't get entered in the exec
log, I found the following issue with a malloc call. I also fixed a typo and a whacky indentation item as well. Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
Diffstat (limited to 'pan')
-rw-r--r--pan/ltp-pan.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/pan/ltp-pan.c b/pan/ltp-pan.c
index a87537097..86cd1542c 100644
--- a/pan/ltp-pan.c
+++ b/pan/ltp-pan.c
@@ -49,7 +49,7 @@
* - added option to create a command file with all failed tests.
*
*/
-/* $Id: ltp-pan.c,v 1.3 2009/06/09 16:14:40 subrata_modak Exp $ */
+/* $Id: ltp-pan.c,v 1.4 2009/10/15 18:45:55 yaberauneya Exp $ */
#include <errno.h>
#include <string.h>
@@ -337,6 +337,11 @@ main(int argc, char **argv)
/* a place to store the pgrps we're watching */
running = (struct tag_pgrp *)malloc((keep_active + 1) * sizeof(struct tag_pgrp));
+ if (running == NULL) {
+ fprintf(stderr, "pan(%s): Failed to allocate memory: %s\n", panname,
+ strerror(errno));
+ exit(2);
+ }
memset(running, 0, keep_active * sizeof(struct tag_pgrp));
running[keep_active].pgrp = -1; /* end sentinel */
@@ -397,7 +402,7 @@ main(int argc, char **argv)
if (outputfilename) {
if (!freopen(outputfilename, "a+", stdout)) {
fprintf(stderr,
- "pan(%s): Error %s (%d) openning output file '%s'\n",
+ "pan(%s): Error %s (%d) opening output file '%s'\n",
panname, strerror(errno), errno, outputfilename);
exit(1);
}
@@ -743,7 +748,7 @@ check_pids(struct tag_pgrp *running, int *num_active, int keep_active,
w);
}
- fflush(logfile);
+ fflush(logfile);
}
if ((failcmdfile != NULL) && (w !=0)) {