From 21bc19e46b8781e52f761656cec20e3e390bbc0a Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Wed, 4 Nov 2020 10:59:35 -0600 Subject: Fix extra { --- P2/lib/utils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/P2/lib/utils.c b/P2/lib/utils.c index 7bdf941..e0683ef 100644 --- a/P2/lib/utils.c +++ b/P2/lib/utils.c @@ -45,7 +45,7 @@ void sendChunkData(char *inputFile, int nMappers) { while(validChar(message.msgText[i])) { message.msgText[i--] = '\0'; } - if (fseek(file, (i - 1023), SEEK_CUR) == -1) { + if (fseek(file, (i - 1023), SEEK_CUR) == -1) break; message.msgType = (map++ % nMappers) + 1; @@ -87,6 +87,8 @@ int getInterData(char *Qkey, int reducerID) { void shuffle(int nMappers, int nReducers) { struct msgBuffer message = makeMessage(); int id = openQueue(); + if (id == -1) + exit(-1); for (int i = 1; i <= nMappers; i++) { char newpath[100]; sprintf(newpath, "output/MapOut/Map_%d", i); // Removed /, add to current dir @@ -106,7 +108,6 @@ void shuffle(int nMappers, int nReducers) { } for (int i = 1; i <= nReducers; i++) { struct msgBuffer END = {i, "END"}; - msgsnd(id, &END, MSGSIZE, 0); if (msgsnd(id, &END, MSGSIZE, 0)) break; } -- cgit v1.2.3