diff options
author | Michael J. Bishop <mbtyke@gmail.com> | 2013-09-25 15:46:27 -0400 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2014-04-29 14:57:48 +0300 |
commit | 288652f0fe673fb218f5ff710f00304e25b87026 (patch) | |
tree | 9a2dd5be9cdbdbf8f4ce0b5ec833b2da1db731db /src | |
parent | d341059aaef966f3d9a34519802f451347f679eb (diff) |
Added file closing to the list of tracked events.
Diffstat (limited to 'src')
-rw-r--r-- | src/library_fs.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/library_fs.js b/src/library_fs.js index e7e194cf..6573fd17 100644 --- a/src/library_fs.js +++ b/src/library_fs.js @@ -736,6 +736,8 @@ mergeInto(LibraryManager.library, { FS.trackingDelegate['didDeleteFile'](old_path); if (FS.trackingDelegate['didOpenFile']) FS.trackingDelegate['didOpenFile'](new_path, FS.tracking.openFlags.WRITE); + if (FS.trackingDelegate['didCloseFile']) + FS.trackingDelegate['didCloseFile'](new_path); } }, rmdir: function(path) { @@ -982,10 +984,10 @@ mergeInto(LibraryManager.library, { } if (FS.trackingDelegate && FS.trackingDelegate['didOpenFile']) { var trackingFlags = 0; - if (!(flags & {{{ cDefine('O_WRONLY')}}})) - trackingFlags != FS.tracking.openFlags.READ; - if (!(flags & {{{ cDefine('O_RDONLY')}}})) - trackingFlags != FS.tracking.openFlags.WRITE; + if ((flags & {{{ cDefine('O_ACCMODE') }}}) !== {{{ cDefine('O_WRONLY') }}}) + trackingFlags |= FS.tracking.openFlags.READ; + if ((flags & {{{ cDefine('O_ACCMODE') }}}) !== {{{ cDefine('O_RDONLY') }}}) + trackingFlags |= FS.tracking.openFlags.WRITE; FS.trackingDelegate['didOpenFile'](path, trackingFlags); } return stream; @@ -999,6 +1001,9 @@ mergeInto(LibraryManager.library, { throw e; } finally { FS.closeStream(stream.fd); + if (FS.trackingDelegate && stream.path && FS.trackingDelegate['didCloseFile']) { + FS.trackingDelegate['didCloseFile'](stream.path); + } } }, llseek: function(stream, offset, whence) { |