aboutsummaryrefslogtreecommitdiffstats
path: root/P2
diff options
context:
space:
mode:
authorAndrea Smith <smit9523@umn.edu>2020-11-03 13:12:56 -0600
committerAndrea Smith <smit9523@umn.edu>2020-11-03 13:12:56 -0600
commit6e5e658a48543429645f11748cdf9bd771424642 (patch)
tree81b9988416e5b845e6ad2332ff48b51d5a7664bf /P2
parentASEDFJAWEIJAWE (diff)
downloadcsci4061-6e5e658a48543429645f11748cdf9bd771424642.tar
csci4061-6e5e658a48543429645f11748cdf9bd771424642.tar.gz
csci4061-6e5e658a48543429645f11748cdf9bd771424642.tar.bz2
csci4061-6e5e658a48543429645f11748cdf9bd771424642.tar.lz
csci4061-6e5e658a48543429645f11748cdf9bd771424642.tar.xz
csci4061-6e5e658a48543429645f11748cdf9bd771424642.tar.zst
csci4061-6e5e658a48543429645f11748cdf9bd771424642.zip
AAAAAAAAAAA
Diffstat (limited to 'P2')
-rw-r--r--P2/lib/utils.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/P2/lib/utils.c b/P2/lib/utils.c
index e023f1a..a5c123f 100644
--- a/P2/lib/utils.c
+++ b/P2/lib/utils.c
@@ -32,6 +32,7 @@ char *getChunkData(int mapperID) {
// DEBUG! malloc a buffer/return
char* value = malloc(1024); // chunkSize or MSGSIZE?
+ strcpy(value, message.msgText);
return value;
// Free memory outside of getChunkData?
@@ -93,9 +94,10 @@ int getInterData(char *Qkey, int reducerID) {
int id = openQueue();
msgrcv(id, &message, MSGSIZE, reducerID, 0);
// printf("INTER DATA: %s\n", message.msgText);
- *Qkey = *message.msgText;
+ // *Qkey = *message.msgText;
+ strcpy(Qkey, message.msgText);
printf("INTER DATA: %s\n", Qkey);
- return (strncmp("END", message.msgText, 3) == 0);
+ return (strncmp("END", message.msgText, 3) != 0);
}
void shuffle(int nMappers, int nReducers) {
@@ -103,11 +105,11 @@ void shuffle(int nMappers, int nReducers) {
struct msgBuffer message = makeMessage();
//Once again, MAKE SURE THIS WORKS PROPERLY!
char path[50];
- getcwd(path, 50);
+ // getcwd(path, 50);
int id = openQueue();
for (int i = 1; i <= nMappers; i++) {
char newpath[100];
- sprintf(newpath, "%s/output/MapOut/Map_%d", path, i);
+ sprintf(newpath, "output/MapOut/Map_%d", i); // Removed /, add to current dir
DIR *dir = opendir(newpath);
struct dirent* entry;
while ((entry = readdir(dir)) != NULL) {