aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Strapp <strap012@umn.edu>2020-10-05 22:41:10 -0500
committerMatt Strapp <strap012@umn.edu>2020-10-05 22:41:10 -0500
commit416670578c7135300435eacfba52a91c2b25fee8 (patch)
tree403d1a46702b6ad21861a4d694b6923ce59ee8df
parentRemove bad file (diff)
downloadcsci4061-416670578c7135300435eacfba52a91c2b25fee8.tar
csci4061-416670578c7135300435eacfba52a91c2b25fee8.tar.gz
csci4061-416670578c7135300435eacfba52a91c2b25fee8.tar.bz2
csci4061-416670578c7135300435eacfba52a91c2b25fee8.tar.lz
csci4061-416670578c7135300435eacfba52a91c2b25fee8.tar.xz
csci4061-416670578c7135300435eacfba52a91c2b25fee8.tar.zst
csci4061-416670578c7135300435eacfba52a91c2b25fee8.zip
Add error handler for mappers
-rw-r--r--P1/src/mapreduce.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/P1/src/mapreduce.c b/P1/src/mapreduce.c
index 9efccf7..2428f75 100644
--- a/P1/src/mapreduce.c
+++ b/P1/src/mapreduce.c
@@ -11,6 +11,10 @@ int main(int argc, char *argv[]) {
// ###### DO NOT REMOVE ######
int nMappers = strtol(argv[1], NULL, 10);
int nReducers = strtol(argv[2], NULL, 10);
+ if (nMappers < nReducers) {
+ printf("Number of mappers must be greater than or equal to the number of reducers.\n");
+ exit(2);
+ }
char *inputFile = argv[3];
// ###### DO NOT REMOVE ######