diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-11-10 10:21:40 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-11-10 10:21:40 -0800 |
commit | fb837edc43d0311bd1685026cf8929611c5aa4d7 (patch) | |
tree | 1841ef613cf69553c82c6d375da5422e2c269953 | |
parent | 28738eb2fa0db8471fc479a848b4096c9c9d9749 (diff) | |
parent | 1c7c811c8ded27a733075529f736797953a5209b (diff) |
Merge pull request #1778 from ToadKing/nanosleep-fix
nanosleep - don't write to rmtp if it's NULL
-rw-r--r-- | src/library.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/library.js b/src/library.js index 31f531e9..e08d63da 100644 --- a/src/library.js +++ b/src/library.js @@ -6131,8 +6131,10 @@ LibraryManager.library = { // int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); var seconds = {{{ makeGetValue('rqtp', C_STRUCTS.timespec.tv_sec, 'i32') }}}; var nanoseconds = {{{ makeGetValue('rqtp', C_STRUCTS.timespec.tv_nsec, 'i32') }}}; - {{{ makeSetValue('rmtp', C_STRUCTS.timespec.tv_sec, '0', 'i32') }}} - {{{ makeSetValue('rmtp', C_STRUCTS.timespec.tv_nsec, '0', 'i32') }}} + if (rmtp !== 0) { + {{{ makeSetValue('rmtp', C_STRUCTS.timespec.tv_sec, '0', 'i32') }}} + {{{ makeSetValue('rmtp', C_STRUCTS.timespec.tv_nsec, '0', 'i32') }}} + } return _usleep((seconds * 1e6) + (nanoseconds / 1000)); }, // TODO: Implement these for real. |