X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Flibgame%2Fzip%2Fminiunz.c;h=cf9839b1bb6c2cb303467e05942181e4c63c8cb4;hp=478d4a8fbb3d1eaf3af3d1fbf30de476059b2dc0;hb=8bdedff68aff9410604ae381dad5bbce8e47a7c9;hpb=fb81506227581bcc04cd4835b8e3f41a109d1f97 diff --git a/src/libgame/zip/miniunz.c b/src/libgame/zip/miniunz.c index 478d4a8f..cf9839b1 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 @@ -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);