Open
Bug 760209
Opened 14 years ago
Updated 3 years ago
nsIZipWriter should fail if none of PR_WRONLY, PR_RDONLY, PR_RDWR are given
Categories
(Core :: Networking: JAR, defect, P5)
Core
Networking: JAR
Tracking
()
NEW
People
(Reporter: ttaubert, Unassigned)
Details
(Whiteboard: [necko-would-take])
Attachments
(1 obsolete file)
It took me quite some time to find out I was accidentally passing a read-only file to nsIZipWriter.open(). ftruncate (on Linux) fails when calling zw.close() and the file is empty.
I was not passing any of RDONLY and WRONLY so I think we should extend the check at the beginning of the method.
Attachment #628822 -
Flags: review?(dtownsend+bugmail)
| Reporter | ||
Updated•14 years ago
|
Attachment #628822 -
Attachment is obsolete: true
Attachment #628822 -
Flags: review?(dtownsend+bugmail)
| Reporter | ||
Comment 1•14 years ago
|
||
(Forget the summary please.)
I want to create a ZipWriter that creates a file if it doesn't exist, yet. If it exists I want to add/modify entries in that file. I'm now using:
> nsIZipWriter.open(file, PR_CREATE);
I add some entries and call nsIZipWriter.close(). Now ftruncate() in nsFileStreamBase::SetEOF() fails somehow and leaves a broken zip file. If I use:
> nsIZipWriter.open(file, PR_CREATE | PR_WRONLY);
it all works well but it overwrites the file every time which isn't what I want.
ftruncate() returns EINVAL which (as offset == 0) can only mean that "The fildes argument is not a file descriptor open for writing."
> ----------------------------------------
Ok, so I totally forgot about PR_RDWR. I of course need to specify that... ZW.open() should bail if none of the Read/Write flags is given.
Summary: nsIZipWriter.open() should fail if a read-only file is passed → nsIZipWriter should fail if none of PR_WRONLY, PR_RDONLY, PR_RDWR are given
Updated•10 years ago
|
Whiteboard: [necko-would-take]
Comment 2•8 years ago
|
||
Bulk change to priority: https://bugzilla.mozilla.org/show_bug.cgi?id=1399258
Priority: -- → P5
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•