Open Bug 248971 Opened 18 years ago Updated 13 years ago

Fix PR_CREATE_FILE w/out PR_TRUNCATE

Categories

(Core :: General, defect)

defect
Not set
normal

Tracking

()

People

(Reporter: dveditz, Unassigned)

Details

(Keywords: helpwanted)

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
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?
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
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
Product: Mozilla Application Suite → Core
QA Contact: general → general
Assignee: dveditz → nobody
You need to log in before you can comment on or make changes to this bug.