X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fzip%2Fminiunz.c;h=1ca632a96bb262f9069475f94eb7a8bc50824dac;hb=HEAD;hp=478d4a8fbb3d1eaf3af3d1fbf30de476059b2dc0;hpb=fb81506227581bcc04cd4835b8e3f41a109d1f97;p=rocksndiamonds.git diff --git a/src/libgame/zip/miniunz.c b/src/libgame/zip/miniunz.c index 478d4a8f..1ca632a9 100644 --- a/src/libgame/zip/miniunz.c +++ b/src/libgame/zip/miniunz.c @@ -16,22 +16,6 @@ See the accompanying LICENSE file for the full text of the license. */ -#if defined(__linux__) -// Linux needs this to support file operation on files larger then 4+GB -# ifndef __USE_FILE_OFFSET64 -# define __USE_FILE_OFFSET64 -# endif -# ifndef __USE_LARGEFILE64 -# define __USE_LARGEFILE64 -# endif -# ifndef _LARGEFILE64_SOURCE -# define _LARGEFILE64_SOURCE -# endif -# ifndef _FILE_OFFSET_BIT -# define _FILE_OFFSET_BIT 64 -# endif -#endif - #include #include #include @@ -405,7 +389,7 @@ static int miniunz_extract_currentfile(unzFile uf, int opt_extract_without_path, err = unzGetCurrentFileInfo64(uf, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0); if (err != UNZ_OK) { - debug_printf("error %d with zipfile in unzGetCurrentFileInfo\n",err); + debug_printf("error %d with zipfile in unzGetCurrentFileInfo\n", err); return err; } @@ -644,18 +628,25 @@ char **zip_extract(char *filename, char *directory) return NULL; } - if (CHDIR(directory)) // change to target directory + if (CHDIR(directory) != 0) // change to target directory { - debug_printf("Cannot change to directory '%s'!\n", directory); + debug_printf("Cannot change to directory '%s'!\n", directory); - unzClose(uf); + unzClose(uf); - return NULL; + return NULL; } int success = (miniunz_extract_all(uf, 0, 1, NULL) == UNZ_OK); - CHDIR(last_directory); // change back to previous directory + if (CHDIR(last_directory) != 0) // change back to previous directory + { + debug_printf("Cannot change to directory '%s'!\n", last_directory); + + unzClose(uf); + + return NULL; + } unzClose(uf);