aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--P2/lib/utils.c6
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");