From 416670578c7135300435eacfba52a91c2b25fee8 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Mon, 5 Oct 2020 22:41:10 -0500 Subject: Add error handler for mappers --- P1/src/mapreduce.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'P1/src') 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 ###### -- cgit v1.2.3