summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-arch/zip/files')
-rw-r--r--app-arch/zip/files/zip-2.3-unix_configure-pic.patch12
-rw-r--r--app-arch/zip/files/zip-2.31-exec-stack.patch20
-rw-r--r--app-arch/zip/files/zip-2.32-build.patch89
-rw-r--r--app-arch/zip/files/zip-3.0-build.patch36
-rw-r--r--app-arch/zip/files/zip-3.0-exec-stack.patch22
-rw-r--r--app-arch/zip/files/zip-3.0-format-security.patch20
-rw-r--r--app-arch/zip/files/zip-3.0-natspec.patch214
-rw-r--r--app-arch/zip/files/zip-3.0-no-crypt.patch57
-rw-r--r--app-arch/zip/files/zip-3.0-pic.patch15
-rw-r--r--app-arch/zip/files/zip-3.0-zipnote-freeze.patch61
10 files changed, 546 insertions, 0 deletions
diff --git a/app-arch/zip/files/zip-2.3-unix_configure-pic.patch b/app-arch/zip/files/zip-2.3-unix_configure-pic.patch
new file mode 100644
index 000000000000..45b137b0ed85
--- /dev/null
+++ b/app-arch/zip/files/zip-2.3-unix_configure-pic.patch
@@ -0,0 +1,12 @@
+--- unix/configure.orig 2004-09-28 06:45:33.000000000 +0000
++++ unix/configure 2004-09-28 06:54:53.000000000 +0000
+@@ -29,6 +29,9 @@
+
+ echo Check if we can use asm code
+ OBJA=""
++piclib="$(echo | $CPP -dM $CFLAGS - | grep -i __pic__)"
++echo "Checking if compiler wants to create pic code"
++[ "$piclib" == "" ] && \
+ if eval "$CPP match.S > _match.s 2>/dev/null"; then
+ if test ! -s _match.s || grep error < _match.s > /dev/null; then
+ :
diff --git a/app-arch/zip/files/zip-2.31-exec-stack.patch b/app-arch/zip/files/zip-2.31-exec-stack.patch
new file mode 100644
index 000000000000..d3efbd902cb1
--- /dev/null
+++ b/app-arch/zip/files/zip-2.31-exec-stack.patch
@@ -0,0 +1,20 @@
+--- zip-2.31/crc_i386.S
++++ zip-2.31/crc_i386.S
+@@ -238,3 +238,7 @@
+ #endif /* i386 || _i386 || _I386 || __i386 */
+
+ #endif /* !USE_ZLIB */
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",@progbits
++#endif
+--- zip-2.31/match.S
++++ zip-2.31/match.S
+@@ -405,3 +405,7 @@
+ #endif /* i386 || _I386 || _i386 || __i386 */
+
+ #endif /* !USE_ZLIB */
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",@progbits
++#endif
diff --git a/app-arch/zip/files/zip-2.32-build.patch b/app-arch/zip/files/zip-2.32-build.patch
new file mode 100644
index 000000000000..61a2bae34b3f
--- /dev/null
+++ b/app-arch/zip/files/zip-2.32-build.patch
@@ -0,0 +1,89 @@
+respect build environment settings
+
+--- zip/unix/Makefile
++++ zip/unix/Makefile
+@@ -12,15 +12,15 @@
+
+ list: all
+
+-MAKE = make -f unix/Makefile
++MAKE := $(MAKE) -f unix/Makefile
+ SHELL = /bin/sh
+ LN = ln -s
+
+ # (to use the Gnu compiler, change cc to gcc in CC)
+-CC = cc
++CC ?= gcc
+ BIND = $(CC)
+ AS = $(CC) -c
+-CPP = /lib/cpp
++CPP ?= $(CC)
+ EXE =
+
+ # probably can change this to 'install' if you have it
+@@ -47,7 +47,7 @@
+ # LFLAGS1 flags after output file spec, before obj file list
+ # LFLAGS2 flags after obj file list (libraries, etc)
+ CFLAGS_NOOPT = -I. -DUNIX $(LOCAL_ZIP)
+-CFLAGS = -O2 $(CFLAGS_NOOPT)
++CFLAGS ?= -O2 $(CFLAGS_NOOPT)
+ LFLAGS1 =
+ LFLAGS2 = -s
+
+--- zip/unix/configure
++++ zip/unix/configure
+@@ -13,52 +13,13 @@
+
+ CC=${1-cc}
+-CFLAGS=${2-"-I. -DUNIX"}
+-LFLAGS1=""
++CFLAGS="${2--I. -DUNIX} ${CFLAGS} ${CPPFLAGS}"
++LFLAGS1="${LDFLAGS}"
+ LN="ln -s"
+-echo "Check C compiler type (optimization option)"
+-cat > conftest.c << _EOF_
+-int main()
+-{
+-#ifndef __SUNPRO_C
+- bad code
+-#endif
+- return 0;
+-}
+-_EOF_
+-$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
+-if test $? -eq 0; then
+- echo ' Sun C (-xO3)'
+- CFLAGS="${CFLAGS} -xO3"
+-else
+- cat > conftest.c << _EOF_
+-int main()
+-{
+-#ifndef __DECC
+- bad code
+-#endif
+- return 0;
+-}
+-_EOF_
+- $CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
+- if test $? -eq 0; then
+- echo ' DEC C (-O3)'
+- CFLAGS="${CFLAGS} -O3"
+- else
+- echo ' Other (gcc?) (-O2)'
+- CFLAGS="${CFLAGS} -O2"
+- fi
+-fi
+
+ echo Check for the C preprocessor
+ # on SVR4, cc -E does not produce correct assembler files. Need /lib/cpp.
+ CPP="${CC} -E"
+ # solaris as(1) needs -P, maybe others as well ?
+-[ -f /usr/ccs/lib/cpp ] && CPP="/usr/ccs/lib/cpp -P"
+-[ -f /usr/lib/cpp ] && CPP=/usr/lib/cpp
+-[ -f /lib/cpp ] && CPP=/lib/cpp
+-[ -f /usr/bin/cpp ] && CPP=/usr/bin/cpp
+-[ -f /xenix ] && CPP="${CC} -E"
+-[ -f /lynx.os ] && CPP="${CC} -E"
+
+ echo "#include <stdio.h>" > conftest.c
+ $CPP conftest.c >/dev/null 2>/dev/null || CPP="${CC} -E"
diff --git a/app-arch/zip/files/zip-3.0-build.patch b/app-arch/zip/files/zip-3.0-build.patch
new file mode 100644
index 000000000000..595303cc48d4
--- /dev/null
+++ b/app-arch/zip/files/zip-3.0-build.patch
@@ -0,0 +1,36 @@
+respect build environment settings
+
+--- zip/unix/configure
++++ zip/unix/configure
+@@ -18,7 +18,7 @@
+
+ CC=${1-cc}
+ CFLAGS=${2-"-I. -DUNIX"}
+-LFLAGS1=''
++LFLAGS1="${LDFLAGS}"
+ LFLAGS2=''
+ LN="ln -s"
+
+@@ -118,7 +118,7 @@ _EOF_
+ fi
+
+ # optimization flags
+-if test -n "${CFLAGS_OPT}"; then
++if false; then
+ CFLAGS="${CFLAGS} ${CFLAGS_OPT}"
+ CFLAGS_BZ="${CFLAGS_BZ} ${CFLAGS_OPT}"
+ fi
+@@ -220,13 +220,6 @@ fi
+ echo Check for the C preprocessor
+ # on SVR4, cc -E does not produce correct assembler files. Need /lib/cpp.
+ CPP="${CC} -E"
+-# solaris as(1) needs -P, maybe others as well ?
+-[ -f /usr/ccs/lib/cpp ] && CPP="/usr/ccs/lib/cpp -P"
+-[ -f /usr/lib/cpp ] && CPP=/usr/lib/cpp
+-[ -f /lib/cpp ] && CPP=/lib/cpp
+-[ -f /usr/bin/cpp ] && CPP=/usr/bin/cpp
+-[ -f /xenix ] && CPP="${CC} -E"
+-[ -f /lynx.os ] && CPP="${CC} -E"
+
+ echo "#include <stdio.h>" > conftest.c
+ $CPP conftest.c >/dev/null 2>/dev/null || CPP="${CC} -E"
diff --git a/app-arch/zip/files/zip-3.0-exec-stack.patch b/app-arch/zip/files/zip-3.0-exec-stack.patch
new file mode 100644
index 000000000000..80719c961298
--- /dev/null
+++ b/app-arch/zip/files/zip-3.0-exec-stack.patch
@@ -0,0 +1,22 @@
+add proper GNU stack markings so we dont get the default: executable
+
+--- zip-2.31/crc_i386.S
++++ zip-2.31/crc_i386.S
+@@ -238,3 +238,7 @@
+ #endif /* i386 || _i386 || _I386 || __i386 */
+
+ #endif /* !USE_ZLIB && !CRC_TABLE_ONLY */
++
++#if defined __ELF__ && defined __linux__
++.section .note.GNU-stack,"",@progbits
++#endif
+--- zip-2.31/match.S
++++ zip-2.31/match.S
+@@ -405,3 +405,7 @@
+ #endif /* i386 || _I386 || _i386 || __i386 */
+
+ #endif /* !USE_ZLIB */
++
++#if defined __ELF__ && defined __linux__
++.section .note.GNU-stack,"",@progbits
++#endif
diff --git a/app-arch/zip/files/zip-3.0-format-security.patch b/app-arch/zip/files/zip-3.0-format-security.patch
new file mode 100644
index 000000000000..1edc2d6a1b88
--- /dev/null
+++ b/app-arch/zip/files/zip-3.0-format-security.patch
@@ -0,0 +1,20 @@
+--- zip.c
++++ zip.c
+@@ -1028,7 +1028,7 @@
+
+ for (i = 0; i < sizeof(text)/sizeof(char *); i++)
+ {
+- printf(text[i]);
++ fputs(text[i], stdout);
+ putchar('\n');
+ }
+ #ifdef DOS
+@@ -1225,7 +1225,7 @@
+ CR_MAJORVER, CR_MINORVER, CR_BETA_VER, CR_VERSION_DATE);
+ for (i = 0; i < sizeof(cryptnote)/sizeof(char *); i++)
+ {
+- printf(cryptnote[i]);
++ fputs(cryptnote[i], stdout);
+ putchar('\n');
+ }
+ ++i; /* crypt support means there IS at least one compilation option */
diff --git a/app-arch/zip/files/zip-3.0-natspec.patch b/app-arch/zip/files/zip-3.0-natspec.patch
new file mode 100644
index 000000000000..1dfce09d1331
--- /dev/null
+++ b/app-arch/zip/files/zip-3.0-natspec.patch
@@ -0,0 +1,214 @@
+This patch makes zip use libnatspec to recode file names is national charset.
+Initially this patch was written for altlinux:
+http://sisyphus.ru/ru/srpm/Sisyphus/zip/patches
+
+Later it was a bit improved and improved version was posted here (in Russian):
+http://www.opennet.ru/tips/info/2494.shtml
+
+Also I've added natspec support to output of zipnote (thank vapier for notice).
+
+Gentoo reference:
+https://bugs.gentoo.org/show_bug.cgi?id=275244
+
+--
+pva@gentoo.org
+
+=== modified file 'fileio.c'
+--- fileio.c 2010-12-22 13:02:43 +0000
++++ fileio.c 2010-12-22 13:03:00 +0000
+@@ -929,7 +929,7 @@
+ }
+ if ((zname = in2ex(iname)) == NULL)
+ return ZE_MEM;
+-#ifdef UNICODE_SUPPORT
++#if defined(UNICODE_SUPPORT) && !defined(UNIX)
+ /* Convert name to display or OEM name */
+ oname = local_to_display_string(iname);
+ #else
+
+=== modified file 'globals.c'
+--- globals.c 2010-12-22 13:02:43 +0000
++++ globals.c 2010-12-22 13:03:00 +0000
+@@ -32,7 +32,7 @@
+ int scanimage = 1; /* 1=scan through image files */
+ #endif
+ int method = BEST; /* one of BEST, DEFLATE (only), or STORE (only) */
+-int dosify = 0; /* 1=make new entries look like MSDOS */
++int dosify = 1; /* 1=make new entries look like MSDOS */
+ int verbose = 0; /* 1=report oddities in zip file structure */
+ int fix = 0; /* 1=fix the zip file, 2=FF, 3=ZipNote */
+ int filesync = 0; /* 1=file sync, delete entries not on file system */
+
+=== modified file 'unix/Makefile'
+--- unix/Makefile 2010-12-22 13:02:43 +0000
++++ unix/Makefile 2010-12-22 15:43:40 +0000
+@@ -38,7 +38,7 @@
+ MANFLAGS = 644
+
+ # target directories - where to install executables and man pages to
+-prefix = /usr/local
++prefix = /usr
+ BINDIR = $(prefix)/bin
+ MANEXT=1
+ MANDIR = $(prefix)/man/man$(MANEXT)
+@@ -61,6 +61,7 @@
+ CFLAGS = -O2 $(CFLAGS_NOOPT)
+ LFLAGS1 =
+ LFLAGS2 = -s
++LDADD = -lnatspec
+
+ # object file lists
+ OBJZ = zip.o zipfile.o zipup.o fileio.o util.o globals.o crypt.o ttyio.o \
+@@ -125,9 +126,9 @@
+ zipsman: $(ZIPS) $(ZIPMANUALs)
+
+ zip$E: $(OBJZ) $(OBJI) $(OBJA) $(LIB_BZ)
+- $(BIND) -o zip$E $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2)
++ $(BIND) -o zip$E $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2) $(LDADD)
+ zipnote$E: $(OBJN)
+- $(BIND) -o zipnote$E $(LFLAGS1) $(OBJN) $(LFLAGS2)
++ $(BIND) -o zipnote$E $(LFLAGS1) $(OBJN) $(LFLAGS2) $(LDADD)
+ zipcloak$E: $(OBJC) $(OCRCTB)
+ $(BIND) -o zipcloak$E $(LFLAGS1) $(OBJC) $(LFLAGS2)
+ zipsplit$E: $(OBJS)
+
+=== modified file 'unix/osdep.h'
+--- unix/osdep.h 2010-12-22 13:02:43 +0000
++++ unix/osdep.h 2010-12-22 15:45:29 +0000
+@@ -78,3 +78,6 @@
+ #if !defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME)
+ # define USE_EF_UT_TIME
+ #endif
++
++/* Set Windows code as archive type */
++# define OS_CODE 0xb00
+
+=== modified file 'unix/unix.c'
+--- unix/unix.c 2010-12-22 13:02:43 +0000
++++ unix/unix.c 2010-12-22 13:03:00 +0000
+@@ -14,6 +14,11 @@
+
+ #include <time.h>
+
++#ifdef UNIX
++# include <natspec.h>
++# include <locale.h>
++#endif
++
+ #if defined(MINIX) || defined(__mpexl)
+ # ifdef S_IWRITE
+ # undef S_IWRITE
+@@ -60,6 +65,7 @@
+
+ /* Local functions */
+ local char *readd OF((DIR *));
++local const char *oem_charset = NULL;
+
+
+ #ifdef NO_DIR /* for AT&T 3B1 */
+@@ -262,6 +268,16 @@
+ if (!pathput)
+ t = last(t, PATH_END);
+
++#ifdef UNIX
++ if (!oem_charset) {
++ setlocale(LC_CTYPE, "");
++ oem_charset = natspec_get_charset_by_locale(NATSPEC_DOSCS, "");
++ }
++ /* Convert to internal encoding */
++ if ((n = natspec_convert(t, oem_charset, 0, 0)) == NULL)
++ return NULL;
++ return n;
++#else
+ /* Malloc space for internal name and copy it */
+ if ((n = malloc(strlen(t) + 1)) == NULL)
+ return NULL;
+@@ -269,6 +285,7 @@
+
+ if (dosify)
+ msname(n);
++#endif
+
+ #ifdef EBCDIC
+ strtoasc(n, n); /* here because msname() needs native coding */
+@@ -289,8 +306,19 @@
+ {
+ char *x; /* external file name */
+
++#ifdef UNIX
++ if (!oem_charset) {
++ oem_charset = natspec_get_charset_by_locale(NATSPEC_DOSCS, "");
++ setlocale(LC_CTYPE, "");
++ }
++ /* Convert to internal encoding */
++ if ((x = natspec_convert(n, 0, oem_charset, 0)) == NULL)
++ return NULL;
++ return x;
++#else
+ if ((x = malloc(strlen(n) + 1 + PAD)) == NULL)
+ return NULL;
++#endif
+ #ifdef EBCDIC
+ strtoebc(x, n);
+ #else
+
+=== modified file 'zip.c'
+--- zip.c 2010-12-22 13:02:43 +0000
++++ zip.c 2010-12-22 13:03:00 +0000
+@@ -2025,6 +2025,7 @@
+ #endif /* ?MACOS */
+ {"J", "junk-sfx", o_NO_VALUE, o_NOT_NEGATABLE, 'J', "strip self extractor from archive"},
+ {"k", "DOS-names", o_NO_VALUE, o_NOT_NEGATABLE, 'k', "force use of 8.3 DOS names"},
++ {"K", "no DOS-names",o_NO_VALUE, o_NOT_NEGATABLE, 'K', "no use 8.3 DOS names"},
+ {"l", "to-crlf", o_NO_VALUE, o_NOT_NEGATABLE, 'l', "convert text file line ends - LF->CRLF"},
+ {"ll", "from-crlf", o_NO_VALUE, o_NOT_NEGATABLE, o_ll, "convert text file line ends - CRLF->LF"},
+ {"lf", "logfile-path",o_REQUIRED_VALUE, o_NOT_NEGATABLE, o_lf, "log to log file at path (default overwrite)"},
+@@ -2289,7 +2290,7 @@
+ dispose = 0; /* 1=remove files after put in zip file */
+ pathput = 1; /* 1=store path with name */
+ method = BEST; /* one of BEST, DEFLATE (only), or STORE (only) */
+- dosify = 0; /* 1=make new entries look like MSDOS */
++ dosify = 1; /* 1=make new entries look like MSDOS */
+ verbose = 0; /* 1=report oddities in zip file structure */
+ fix = 0; /* 1=fix the zip file */
+ adjust = 0; /* 1=adjust offsets for sfx'd file (keep preamble) */
+@@ -2859,6 +2860,8 @@
+ junk_sfx = 1; break;
+ case 'k': /* Make entries using DOS names (k for Katz) */
+ dosify = 1; break;
++ case 'K': /* Make entries using DOS names (K for Kompat) */
++ dosify = 0; break;
+ case 'l': /* Translate end-of-line */
+ translate_eol = 1; break;
+ case o_ll:
+
+=== modified file 'zipnote.c'
+--- zipnote.c 2010-12-22 13:02:43 +0000
++++ zipnote.c 2010-12-22 15:42:45 +0000
+@@ -21,6 +21,11 @@
+ #include "revision.h"
+ #include <signal.h>
+
++#ifdef UNIX
++# include <natspec.h>
++# include <locale.h>
++#endif
++
+ /* Calculate size of static line buffer used in write (-w) mode. */
+ #define WRBUFSIZ 2047
+ /* The line buffer size should be at least as large as FNMAX. */
+@@ -537,7 +542,13 @@
+ {
+ for (z = zfiles; z != NULL; z = z->nxt)
+ {
++#ifdef UNIX
++ char *oem_charset = NULL;
++ oem_charset = natspec_get_charset_by_locale(NATSPEC_DOSCS, "");
++ printf("%c %s\n", MARK, natspec_convert(z->zname, 0, oem_charset, 0));
++#else
+ printf("%c %s\n", MARK, z->zname);
++#endif
+ putclean(z->comment, z->com);
+ printf("%c%s\n", MARK, MARKE);
+ }
+
diff --git a/app-arch/zip/files/zip-3.0-no-crypt.patch b/app-arch/zip/files/zip-3.0-no-crypt.patch
new file mode 100644
index 000000000000..2858b51ec2c9
--- /dev/null
+++ b/app-arch/zip/files/zip-3.0-no-crypt.patch
@@ -0,0 +1,57 @@
+fix building when NO_CRYPT is used
+
+forward ported from zip-2.32
+
+http://bugs.gentoo.org/238398
+
+--- zip.c
++++ zip.c
+@@ -3452,6 +3452,9 @@ char **argv; /* command line tokens */
+
+ /* Key not yet specified. If needed, get/verify it now. */
+ if (key_needed) {
++#if !CRYPT
++ ZIPERR(ZE_PARMS, "encryption not supported");
++#else /* CRYPT */
+ if ((key = malloc(IZ_PWLEN+1)) == NULL) {
+ ZIPERR(ZE_MEM, "was getting encryption password");
+ }
+@@ -3478,6 +3481,7 @@ char **argv; /* command line tokens */
+ if (r) {
+ ZIPERR(ZE_PARMS, "password verification failed");
+ }
++#endif
+ }
+ if (key) {
+ /* if -P "" could get here */
+--- zipcloak.c
++++ zipcloak.c
+@@ -744,6 +744,28 @@ struct option_struct far options[] = {
+
+ int main OF((void));
+
++void zipmessage_nl(a, nl)
++ZCONST char *a;
++int nl;
++{
++}
++
++void zipmessage(a, b)
++ZCONST char *a, *b;
++{
++}
++
++int set_filetype(out_path)
++ char *out_path;
++{
++}
++
++int rename_split(temp_name, out_path)
++ char *temp_name;
++ char *out_path;
++{
++}
++
+ void zipwarn(msg1, msg2)
+ ZCONST char *msg1, *msg2;
+ {
diff --git a/app-arch/zip/files/zip-3.0-pic.patch b/app-arch/zip/files/zip-3.0-pic.patch
new file mode 100644
index 000000000000..b4c53de694f7
--- /dev/null
+++ b/app-arch/zip/files/zip-3.0-pic.patch
@@ -0,0 +1,15 @@
+if our toolchain generates PIC by default, then do not use the hand written
+assembly files as none of it is PIC friendly.
+
+--- unix/configure
++++ unix/configure
+@@ -29,6 +29,9 @@
+ echo Check if we can use asm code
+ OBJA=""
+ OCRCU8=""
++piclib="$(echo | $CPP -dM $CFLAGS - | grep -i __pic__)"
++echo "Checking if compiler wants to create pic code"
++[ "$piclib" == "" ] && \
+ if eval "$CPP match.S > _match.s 2>/dev/null"; then
+ if test ! -s _match.s || grep error < _match.s > /dev/null; then
+ :
diff --git a/app-arch/zip/files/zip-3.0-zipnote-freeze.patch b/app-arch/zip/files/zip-3.0-zipnote-freeze.patch
new file mode 100644
index 000000000000..cfe78f0a100a
--- /dev/null
+++ b/app-arch/zip/files/zip-3.0-zipnote-freeze.patch
@@ -0,0 +1,61 @@
+diff -dupr zip30-old/fileio.c zip30/fileio.c
+--- zip30-old/fileio.c 2008-05-28 20:13:24.000000000 +0200
++++ zip30/fileio.c 2012-06-12 17:30:29.794547493 +0200
+@@ -3502,7 +3502,7 @@ zwchar *local_to_wide_string(local_strin
+ if ((wc_string = (wchar_t *)malloc((wsize + 1) * sizeof(wchar_t))) == NULL) {
+ ZIPERR(ZE_MEM, "local_to_wide_string");
+ }
+- wsize = mbstowcs(wc_string, local_string, strlen(local_string) + 1);
++ wsize = mbstowcs(wc_string, local_string, wsize + 1);
+ wc_string[wsize] = (wchar_t) 0;
+
+ /* in case wchar_t is not zwchar */
+diff -dupr zip30-old/zipfile.c zip30/zipfile.c
+--- zip30/zipfile.c 2008-07-01 00:15:30.000000000 +0200
++++ zip30/zipfile.c 2012-06-10 01:59:42.571706181 +0200
+@@ -5406,6 +5406,8 @@ int putlocal(z, rewrite)
+ if (z->flg & UTF8_BIT) {
+ /* If this flag is set, then restore UTF-8 as path name */
+ use_uname = 1;
++ tempzn -= nam;
+ nam = strlen(z->uname);
++ tempzn += nam;
+ } else {
+ /* use extra field */
+ add_Unicode_Path_local_extra_field(z);
+@@ -5647,7 +5650,9 @@ int putcentral(z)
+ if (z->flg & UTF8_BIT) {
+ /* If this flag is set, then restore UTF-8 as path name */
+ use_uname = 1;
++ tempzn -= nam;
+ nam = strlen(z->uname);
++ tempzn += nam;
+ } else {
+ add_Unicode_Path_cen_extra_field(z);
+ }
+diff -dupr zip30/zipnote.c zip30/zipnote.c
+--- zip30/zipnote.c 2008-05-08 04:17:08.000000000 +0200
++++ zip30/zipnote.c 2012-06-10 02:33:36.372663528 +0200
+@@ -575,6 +575,13 @@ char **argv; /* command line
+ strcpy(z->iname, a+2);
+ #endif
+
++#ifdef UNICODE_SUPPORT
++#define UTF8_BIT (1 << 11)
++ if (using_utf8) {
++ z->uname = z->iname;
++ }
++#endif
++
+ /*
+ * Don't update z->nam here, we need the old value a little later.....
+ * The update is handled in zipcopy().
+@@ -661,7 +668,7 @@ char **argv; /* command line
+ if ((r = zipcopy(z)) != ZE_OK)
+ ziperr(r, "was copying an entry");
+ }
+- fclose(x);
++ fclose(in_file);
+
+ /* Write central directory and end of central directory with new comments */
+ if ((c = zftello(y)) == (zoff_t)-1) /* get start of central */