src/java.base/share/native/libzip/zip_util.c

Print this page

        

*** 35,44 **** --- 35,45 ---- #include <limits.h> #include <time.h> #include <ctype.h> #include <assert.h> + #include "jdk_strerror.h" #include "jni.h" #include "jni_util.h" #include "jlong.h" #include "jvm.h" #include "io_util.h"
*** 1436,1445 **** --- 1437,1447 ---- */ jboolean JNICALL ZIP_ReadEntry(jzfile *zip, jzentry *entry, unsigned char *buf, char *entryname) { char *msg; + char tmpbuf[1024]; strcpy(entryname, entry->name); if (entry->csize == 0) { /* Entry is stored */ jlong pos = 0;
*** 1454,1465 **** ZIP_Lock(zip); n = ZIP_Read(zip, entry, pos, buf, count); msg = zip->msg; ZIP_Unlock(zip); if (n == -1) { ! jio_fprintf(stderr, "%s: %s\n", zip->name, ! msg != 0 ? msg : strerror(errno)); return JNI_FALSE; } buf += n; pos += n; } --- 1456,1470 ---- ZIP_Lock(zip); n = ZIP_Read(zip, entry, pos, buf, count); msg = zip->msg; ZIP_Unlock(zip); if (n == -1) { ! if (msg == 0) { ! jdk_strerror(errno, tmpbuf, (size_t) 1024); ! msg = tmpbuf; ! } ! jio_fprintf(stderr, "%s: %s\n", zip->name, msg); return JNI_FALSE; } buf += n; pos += n; }
*** 1468,1479 **** int ok = InflateFully(zip, entry, buf, &msg); if (!ok) { if ((msg == NULL) || (*msg == 0)) { msg = zip->msg; } ! jio_fprintf(stderr, "%s: %s\n", zip->name, ! msg != 0 ? msg : strerror(errno)); return JNI_FALSE; } } ZIP_FreeEntry(zip, entry); --- 1473,1487 ---- int ok = InflateFully(zip, entry, buf, &msg); if (!ok) { if ((msg == NULL) || (*msg == 0)) { msg = zip->msg; } ! if (msg == 0) { ! jdk_strerror(errno, tmpbuf, (size_t) 1024); ! msg = tmpbuf; ! } ! jio_fprintf(stderr, "%s: %s\n", zip->name, msg); return JNI_FALSE; } } ZIP_FreeEntry(zip, entry);