From d114e5bb4ceed6a517fe7c81dda12b8edc7b52dc Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Thu, 20 Jul 2017 11:23:57 +0200 Subject: [PATCH 1/2] pak: cleanup code we do not need to close file descriptors before exit because exit does that for us --- src/pak_creator.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/pak_creator.c b/src/pak_creator.c index e6f94109a..77a2e6da1 100644 --- a/src/pak_creator.c +++ b/src/pak_creator.c @@ -27,7 +27,7 @@ FileData *fileData; static int countFiles(char *); static void cleanup(void); static void recurseDirectory(char *); -static void compressFile(char *, DIR *); +static void compressFile(char *); static void testPak(char *); int main(int argc, char *argv[]) @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) recurseDirectory(argv[i]); } - compressFile(versionName, NULL); + compressFile(versionName); remove(versionName); @@ -205,14 +205,14 @@ static void recurseDirectory(char *dirName) else { - compressFile(filename, dirp); + compressFile(filename); } } closedir(dirp); } -static void compressFile(char *filename, DIR *dirp) +static void compressFile(char *filename) { FILE *infile; int compressionResult; @@ -228,7 +228,6 @@ static void compressFile(char *filename, DIR *dirp) { printf("Couldn't open %s for reading!\n", filename); - closedir(dirp); fclose(pak); exit(1); @@ -275,8 +274,6 @@ static void compressFile(char *filename, DIR *dirp) { printf("Couldn't open %s for reading!\n", filename); - closedir(dirp); - fclose(pak); exit(1); From 12914cc58f7e4819cee2f36e75f4a0a67eb10644 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Thu, 20 Jul 2017 12:16:20 +0200 Subject: [PATCH 2/2] fix typo --- src/pak_creator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pak_creator.c b/src/pak_creator.c index 77a2e6da1..7f3d077b0 100644 --- a/src/pak_creator.c +++ b/src/pak_creator.c @@ -180,7 +180,7 @@ static void recurseDirectory(char *dirName) if (dirp == NULL) { - printf("%s: Directory does not exist or is not accessable\n", dirName); + printf("%s: Directory does not exist or is not accessible\n", dirName); exit(1); }