diff options
author | Bruce Mitchener <bruce.mitchener@gmail.com> | 2013-10-01 14:41:23 +0700 |
---|---|---|
committer | Bruce Mitchener <bruce.mitchener@gmail.com> | 2013-10-01 14:41:23 +0700 |
commit | 06a06823b740489674b99757ffaa860378e06fb3 (patch) | |
tree | 2dc5366850081d36b0d0f30e11e0d77ba24c31c5 | |
parent | 0a8f236b9ebc62b8c6fffd2f6ebdff577a407a0b (diff) |
Break up mkstemp impl to provide mktemp impl.
The libcxx test suite wants mktemp(), so provide it by pulling
out some of the internals of mkstemp().
-rw-r--r-- | src/library.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/library.js b/src/library.js index 02981a80..3e69cc08 100644 --- a/src/library.js +++ b/src/library.js @@ -459,14 +459,17 @@ LibraryManager.library = { // http://pubs.opengroup.org/onlinepubs/009695399/functions/creat.html return _open(path, {{{ cDefine('O_WRONLY') }}} | {{{ cDefine('O_CREAT') }}} | {{{ cDefine('O_TRUNC') }}}, allocate([mode, 0, 0, 0], 'i32', ALLOC_STACK)); }, - mkstemp__deps: ['creat'], - mkstemp: function(template) { - if (!_mkstemp.counter) _mkstemp.counter = 0; - var c = (_mkstemp.counter++).toString(); + mktemp: function(template) { + if (!_mktemp.counter) _mktemp.counter = 0; + var c = (_mktemp.counter++).toString(); var rep = 'XXXXXX'; while (c.length < rep.length) c = '0' + c; writeArrayToMemory(intArrayFromString(c), template + Pointer_stringify(template).indexOf(rep)); - return _creat(template, 0600); + return template; + }, + mkstemp__deps: ['creat', 'mktemp'], + mkstemp: function(template) { + return _creat(_mktemp(template), 0600); }, fcntl__deps: ['$FS', '__setErrNo', '$ERRNO_CODES'], fcntl: function(fildes, cmd, varargs, dup2) { |