- Doing open(O_WRONLY) and then fdopen("w+") will now fail with
"Invalid Argument" whereas former glibcs would succeed. So now do open(O_RDWR). - Print error message when open(2) fails. - Add debugging traces in open_outfile. OBS-URL: https://build.opensuse.org/package/show/Archiving/unzip?expand=0&rev=9
This commit is contained in:
parent
ae7f693109
commit
f55ede6623
@ -1,7 +1,7 @@
|
|||||||
Index: fileio.c
|
Index: fileio.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- fileio.c.orig 2010-05-21 14:25:41.384590892 +0200
|
--- fileio.c.orig 2009-04-20 02:03:44.000000000 +0200
|
||||||
+++ fileio.c 2010-05-21 14:32:27.459889721 +0200
|
+++ fileio.c 2010-06-25 18:32:49.960030697 +0200
|
||||||
@@ -71,6 +71,11 @@
|
@@ -71,6 +71,11 @@
|
||||||
#include "crc32.h"
|
#include "crc32.h"
|
||||||
#include "crypt.h"
|
#include "crypt.h"
|
||||||
@ -9,8 +9,8 @@ Index: fileio.c
|
|||||||
+#include <sys/types.h>
|
+#include <sys/types.h>
|
||||||
+#include <sys/stat.h>
|
+#include <sys/stat.h>
|
||||||
+#include <fcntl.h>
|
+#include <fcntl.h>
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
|
|
||||||
/* setup of codepage conversion for decryption passwords */
|
/* setup of codepage conversion for decryption passwords */
|
||||||
#if CRYPT
|
#if CRYPT
|
||||||
@ -22,22 +22,56 @@ Index: fileio.c
|
|||||||
#ifdef DLL
|
#ifdef DLL
|
||||||
if (G.redirect_data)
|
if (G.redirect_data)
|
||||||
return (redirect_outfile(__G) == FALSE);
|
return (redirect_outfile(__G) == FALSE);
|
||||||
@@ -454,13 +460,16 @@ int open_outfile(__G) /* retur
|
@@ -448,23 +454,48 @@ int open_outfile(__G) /* retur
|
||||||
|
return 1; /* with "./" fix in checkdir(), should never reach here */
|
||||||
|
}
|
||||||
|
#endif /* NOVELL_BUG_FAILSAFE */
|
||||||
|
- Trace((stderr, "open_outfile: doing fopen(%s) for writing\n",
|
||||||
|
- FnFilter1(G.filename)));
|
||||||
|
{
|
||||||
#if defined(ATH_BE_UNX) || defined(AOS_VS) || defined(QDOS) || defined(TANDEM)
|
#if defined(ATH_BE_UNX) || defined(AOS_VS) || defined(QDOS) || defined(TANDEM)
|
||||||
mode_t umask_sav = umask(0077);
|
mode_t umask_sav = umask(0077);
|
||||||
#endif
|
#endif
|
||||||
+ fd = open(G.filename, O_WRONLY | O_LARGEFILE | O_CREAT,
|
+
|
||||||
+ /* 0644 in portable POSIX notation: */
|
+#if defined(SYMLINKS) || defined(QLZIP)
|
||||||
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
+ fd = open(G.filename, O_RDWR | O_LARGEFILE | O_CREAT,
|
||||||
|
+ /* 0644 in portable POSIX notation: */
|
||||||
|
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||||
|
+#else
|
||||||
|
+ fd = open(G.filename, O_WRONLY | O_LARGEFILE | O_CREAT,
|
||||||
|
+ /* 0644 in portable POSIX notation: */
|
||||||
|
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||||
|
+#endif
|
||||||
|
+ Trace((stderr, "open_outfile: open(%s, O_WRONLY | O_LARGEFILE | O_CREAT) returned %d\n",
|
||||||
|
+ FnFilter1(G.filename), fd));
|
||||||
|
+
|
||||||
|
+ if (fd < 0) {
|
||||||
|
+ Info(slide, 0x401, ((char *)slide, LoadFarString(CannotCreateFile),
|
||||||
|
+ FnFilter1(G.filename), strerror(errno)));
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
#if defined(SYMLINKS) || defined(QLZIP)
|
#if defined(SYMLINKS) || defined(QLZIP)
|
||||||
/* These features require the ability to re-read extracted data from
|
/* These features require the ability to re-read extracted data from
|
||||||
the output files. Output files are created with Read&Write access.
|
the output files. Output files are created with Read&Write access.
|
||||||
*/
|
*/
|
||||||
- G.outfile = zfopen(G.filename, FOPWR);
|
- G.outfile = zfopen(G.filename, FOPWR);
|
||||||
|
+
|
||||||
+ G.outfile = zfdopen(fd, FOPWR);
|
+ G.outfile = zfdopen(fd, FOPWR);
|
||||||
|
+
|
||||||
|
+ Trace((stderr, "open_outfile: doing fdopen(%s, FOPWR) returned %p\n",
|
||||||
|
+ G.outfile));
|
||||||
#else
|
#else
|
||||||
- G.outfile = zfopen(G.filename, FOPW);
|
- G.outfile = zfopen(G.filename, FOPW);
|
||||||
+ G.outfile = zfdopen(fd, FOPW);
|
+ G.outfile = zfdopen(fd, FOPW);
|
||||||
|
+
|
||||||
|
+ Trace((stderr, "open_outfile: doing fdopen(%s, FOPW) returned %p\n",
|
||||||
|
+ G.outfile));
|
||||||
#endif
|
#endif
|
||||||
#if defined(ATH_BE_UNX) || defined(AOS_VS) || defined(QDOS) || defined(TANDEM)
|
#if defined(ATH_BE_UNX) || defined(AOS_VS) || defined(QDOS) || defined(TANDEM)
|
||||||
umask(umask_sav);
|
umask(umask_sav);
|
||||||
|
#endif
|
||||||
|
+ if (G.outfile == NULL && fd != 0)
|
||||||
|
+ unlink(G.filename);
|
||||||
|
}
|
||||||
|
if (G.outfile == (FILE *)NULL) {
|
||||||
|
Info(slide, 0x401, ((char *)slide, LoadFarString(CannotCreateFile),
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Jun 25 18:21:34 CEST 2010 - pth@suse.de
|
||||||
|
|
||||||
|
- Doing open(O_WRONLY) and then fdopen("w+") will now fail with
|
||||||
|
"Invalid Argument" whereas former glibcs would succeed. So now
|
||||||
|
do open(O_RDWR).
|
||||||
|
- Print error message when open(2) fails.
|
||||||
|
- Add debugging traces in open_outfile.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri May 21 16:39:24 CEST 2010 - pth@suse.de
|
Fri May 21 16:39:24 CEST 2010 - pth@suse.de
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user