diff options
author | Matt Strapp <strap012@umn.edu> | 2020-10-26 08:28:06 -0500 |
---|---|---|
committer | Matt Strapp <strap012@umn.edu> | 2020-10-26 08:28:06 -0500 |
commit | 1955fc20d88d420406dd36a231431cd3410d7d53 (patch) | |
tree | 8998ef207083d0a9ef21965b0bbb093243edf743 /P2/lib | |
parent | Fix smol things (diff) | |
download | csci4061-1955fc20d88d420406dd36a231431cd3410d7d53.tar csci4061-1955fc20d88d420406dd36a231431cd3410d7d53.tar.gz csci4061-1955fc20d88d420406dd36a231431cd3410d7d53.tar.bz2 csci4061-1955fc20d88d420406dd36a231431cd3410d7d53.tar.lz csci4061-1955fc20d88d420406dd36a231431cd3410d7d53.tar.xz csci4061-1955fc20d88d420406dd36a231431cd3410d7d53.tar.zst csci4061-1955fc20d88d420406dd36a231431cd3410d7d53.zip |
Add error checking
Diffstat (limited to '')
-rw-r--r-- | P2/lib/utils.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/P2/lib/utils.c b/P2/lib/utils.c index 5a5a09d..603a699 100644 --- a/P2/lib/utils.c +++ b/P2/lib/utils.c @@ -8,7 +8,7 @@ char *getChunkData(int mapperID) { int mid; //Queue Key key_t key = 10; - mid = msgget(key, 0666); + mid = msgget(key, 0666 | IPC_CREAT); if (mid < 0) { perror("Cannot open queue.\n"); return NULL; @@ -30,6 +30,10 @@ void sendChunkData(char *inputFile, int nMappers) { // open message queue msgid = msgget(key, 0666 | IPC_CREAT); + if (msgid < 0) { + perror("Cannot open queue.\n"); + exit(-1); + } // message.msgText = 1; FILE *fptr = fopen(inputFile, "r"); |