Skip to content

Commit

Permalink
jsc/wasm32/wasm32.jsc: don't write read-only files
Browse files Browse the repository at this point in the history
  • Loading branch information
pipcet committed Feb 7, 2021
1 parent b14c5a6 commit 1c970e3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion jsc/wasm32/wasm32.jsc
Original file line number Diff line number Diff line change
Expand Up @@ -2963,7 +2963,7 @@ ThinThinFD.prototype.close = function ()

//delete this.process.fds[this.fdno];

if (this.fdno >= 3 && this.writeData !== "") {
if (this.fdno >= 3 && this.written && this.writeData !== "") {
let buf = new ArrayBuffer(this.writeData.length);
let arr = new Uint8Array(buf);
for (let i = 0; i < this.writeData.length; i++) {
Expand Down Expand Up @@ -3305,6 +3305,7 @@ ThinThinFD.prototype.write = function (heap, ptr, len) {

var data = "";

this.written = true;
if (this.writePosition !== undefined && this.writeData) {
let data = this.writeData.substr(0, this.writePosition);
for (let i = 0; i < len; i++) {
Expand Down

0 comments on commit 1c970e3

Please sign in to comment.