Closed
Bug 889908
Opened 11 years ago
Closed 11 years ago
OS.File.writeAtomic doesn't handle file open error for some writes
Categories
(Toolkit Graveyard :: OS.File, defect)
Toolkit Graveyard
OS.File
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla25
People
(Reporter: Irving, Assigned: Irving)
Details
Attachments
(1 file, 1 obsolete file)
1003 bytes,
patch
|
Yoric
:
review+
|
Details | Diff | Splinter Review |
After the recent sync-write-removal patch, OS.File.writeAtomic no longer reports errors correctly for some file opens. https://hg.mozilla.org/mozilla-central/file/2cae857c17cb/toolkit/components/osfile/osfile_shared_front.jsm#l362 359 if (!options.flush) { 360 // Just write, without any renaming trick 361 let dest; 362 try { 363 dest = OS.File.open(path, {write: true, truncate: true}); 364 return dest.write(buffer, options); 365 } finally { 366 dest.close(); 367 } 368 } If OS.File.open() fails, the finally() block throws a JS error because dest is undefined.
Attachment #770867 -
Flags: review?(dteller)
Comment 1•11 years ago
|
||
Comment on attachment 770867 [details] [diff] [review] Null check the destination file before closing Review of attachment 770867 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/components/osfile/osfile_shared_front.jsm @@ +368,2 @@ > } > } Actually, we could just move the |open| out of the try.
Attachment #770867 -
Flags: review?(dteller) → feedback+
Assignee | ||
Comment 2•11 years ago
|
||
Or we could do it this way...
Attachment #770867 -
Attachment is obsolete: true
Attachment #770902 -
Flags: review?(dteller)
Updated•11 years ago
|
Attachment #770902 -
Flags: review?(dteller) → review+
Assignee | ||
Comment 3•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/a828fef4d274
Comment 4•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/a828fef4d274
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
Updated•11 months ago
|
Product: Toolkit → Toolkit Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•