From 0f659937c89403e0c3a5f1b140d4789b2c87c06f Mon Sep 17 00:00:00 2001 From: lindes Date: Fri, 24 Aug 2001 21:15:04 +0000 Subject: [PATCH] cleanup... ugh. --- loader.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/loader.c b/loader.c index 1ad6e51..0ef0ddf 100644 --- a/loader.c +++ b/loader.c @@ -9,8 +9,9 @@ #include #include #include +#include -int main(int argc, char *argv) +int main(int argc, char *argv[]) { int ttl, /* how long to load things */ forks; /* how many jobs to run at once */ @@ -25,8 +26,18 @@ int main(int argc, char *argv) for(/*pre-initted*/; --forks > 0 ;) { - if(pid = fork()) + if((pid = fork()) != 0) + { + /* check to see if the fork actually failed: */ + if(pid < 0) + { + perror("fork failed"); + exit(1); + } + + /* otherwise, we're a child... */ break; /* don't continue this loop as child. */ + } } printf("Bomb running for %d seconds\n", ttl);