aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormax99x <max99x@gmail.com>2011-07-14 18:38:01 +0300
committermax99x <max99x@gmail.com>2011-07-14 18:53:57 +0300
commit1e8f828cb5f2c3c60ab5b982590df5cb7bb6a19b (patch)
tree02949699ed6d1931e56a5c5f299c8c8bff89bf2f
parentf1507e847df81ff018d43e41c4382aea2361d065 (diff)
Removed errno global since it's implemented via __errno_location().
-rw-r--r--src/library.js12
-rw-r--r--tests/runner.py3
2 files changed, 7 insertions, 8 deletions
diff --git a/src/library.js b/src/library.js
index b6d9afd4..7e97a01d 100644
--- a/src/library.js
+++ b/src/library.js
@@ -2233,20 +2233,16 @@ var Library = {
11: 'Resource temporarily unavailable',
18: 'Invalid cross-device link'
},
- errno: 0,
- __setErrNo__deps: ['errno'],
__setErrNo: function(value) {
- // NOTE: This still doesn't fix the case where errno is updated from user
- // code, but it works for errno being set from our library.
+ // For convenient setting and returning of errno.
var me = ___setErrNo;
if (!me.ptr) me.ptr = Pointer_make([0], 0, ALLOC_STATIC, 'i32');
{{{ makeSetValue('me.ptr', '0', 'value', 'i32') }}}
- _errno = value;
- return value; // For convenient setting and returning of errno.
+ return value;
},
__errno_location__deps: ['__setErrNo'],
- __errno_location: function() {
- if (___setErrNo.ptr === undefined) ___setErrNo(0);
+ __errno_location: function() {
+ if (!___setErrNo.ptr) ___setErrNo(0);
return ___setErrNo.ptr;
},
diff --git a/tests/runner.py b/tests/runner.py
index 7077fe8a..1e8828a0 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -693,6 +693,8 @@ if 'benchmark' not in sys.argv:
printf("<%s>\n", buffer);
printf("<%d>\n", strerror_r(EWOULDBLOCK, buffer, 0));
+ errno = 123;
+ printf("<%d>\n", errno);
return 0;
}
@@ -701,6 +703,7 @@ if 'benchmark' not in sys.argv:
<Numerical argument out of domain>
<Resource temporarily unavailable>
<34>
+ <123>
'''
self.do_test(src, re.sub('(^|\n)\s+', '\\1', expected))