Fix PR_CREATE_FILE w/out PR_TRUNCATE

NEW
Unassigned

Status

()

15 years ago
9 years ago

People

(Reporter: dveditz, Unassigned)

Tracking

({helpwanted})

Trunk
helpwanted
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

15 years ago
PR_CREATE_FILE has no effect if the file already exists, PR_TRUNCATE must be
used to remove the old contents. See bug 246687 -- fix other places where this
misconception occurs.
 - libreg vr_stubs.h
 - ZFILE_CREATE in nsZipArchive.cpp
Check for others
Product: Browser → Seamonkey

Comment 1

14 years ago
Dan, can you direct me even casually with this bug, as in what exactly am I to
look for, and is PR_TRUNCATE an appropriate "fix", or are you still planning to
get to this?
(Reporter)

Comment 2

14 years ago
PR_TRUNCATE is absolutely the right thing to do when creating a new file, see
http://lxr.mozilla.org/mozilla/source/nsprpub/pr/include/prio.h#582

PR_APPEND is used in some places, too. It really should be one or the other, or
else we ought to be doing something like CreateUnique() if we don't want to blow
away what's there already (temp files in several of the mailnews spots?).

http://lxr.mozilla.org/mozilla/search?string=PR_CREATE_FILE is a start, inspect
the ones that don't already explicitly truncate or append.
Keywords: helpwanted

Comment 4

14 years ago
As for: - ZFILE_CREATE in nsZipArchive.cpp, the Truncate is not needed as
zipArchive first deletes the old file (for correct attribute settings).
http://lxr.mozilla.org/mozilla/source/modules/libjar/nsZipArchive.cpp#665

Updated

13 years ago
Component: General → General
Product: Mozilla Application Suite → Core
QA Contact: general → general
(Reporter)

Updated

9 years ago
Assignee: dveditz → nobody
You need to log in before you can comment on or make changes to this bug.