diff --git a/src/stuffy.c b/src/stuffy.c index c023ac9..89287ed 100644 --- a/src/stuffy.c +++ b/src/stuffy.c @@ -176,12 +176,7 @@ void AddToArchive(char* archiveName, char* filename) fprintf(stderr, "%s not found.\n", filename); return; } - int archiveFD = OpenArchive(archiveName, O_RDWR | O_CREAT); - do - { - readSize = ReadSingleModuleFromArchive(archiveFD, &(module)); - free(module.moduleData); - } while (readSize > 0); + int archiveFD = OpenArchive(archiveName, O_WRONLY | O_APPEND| O_CREAT); LoadModuleFromFile(filename, &module); strcpy(module.moduleHeader.moduleName, filenameCleaned); WriteSingleModuleToArchive(archiveFD, &module); @@ -302,4 +297,4 @@ void ExtractArchive(int argc, char* argv[]) int writeSize; writeSize = _ExtractArchive(argv[2], argv[3]); return; -} \ No newline at end of file +}