aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRanger Harke <ranger.harke@autodesk.com>2013-08-28 14:04:55 -0400
committerRanger Harke <ranger.harke@autodesk.com>2013-08-28 15:38:29 -0400
commit05b1fe0a482da02f4c913d675b9e054527d4ad27 (patch)
tree97956bde0cc6dcb69697ad2c7584491ab56bc8f7 /tests
parent15a0da1fb0309d0cc552f37a8794427cf967ea52 (diff)
Fix permissions set by FS.createDevice
The read and write permission bits were reversed. A test has been added to ensure that this works.
Diffstat (limited to 'tests')
-rw-r--r--tests/unistd/io.c13
-rw-r--r--tests/unistd/io.js2
-rw-r--r--tests/unistd/io.out5
3 files changed, 20 insertions, 0 deletions
diff --git a/tests/unistd/io.c b/tests/unistd/io.c
index eeb80373..a96290ef 100644
--- a/tests/unistd/io.c
+++ b/tests/unistd/io.c
@@ -34,6 +34,19 @@ int main() {
printf("errno: %d\n\n", errno);
errno = 0;
+ int cd_ro_r = open("/createDevice-read-only", O_RDONLY);
+ printf("open read-only device from createDevice for read, errno: %d\n", errno);
+ errno = 0;
+ int cd_ro_w = open("/createDevice-read-only", O_WRONLY);
+ printf("open read-only device from createDevice for write, errno: %d\n", errno);
+ errno = 0;
+ int cd_wo_r = open("/createDevice-write-only", O_RDONLY);
+ printf("open write-only device from createDevice for read, errno: %d\n", errno);
+ errno = 0;
+ int cd_wo_w = open("/createDevice-write-only", O_WRONLY);
+ printf("open write-only device from createDevice for write, errno: %d\n\n", errno);
+ errno = 0;
+
int f = open("/file", O_RDWR);
printf("read from file: %d\n", read(f, readBuffer, sizeof readBuffer));
printf("data: %s\n", readBuffer);
diff --git a/tests/unistd/io.js b/tests/unistd/io.js
index e2e442ec..cf66a438 100644
--- a/tests/unistd/io.js
+++ b/tests/unistd/io.js
@@ -14,6 +14,8 @@
}, function(arg) {
throw new Error('Broken device output.');
});
+ FS.createDevice('/', 'createDevice-read-only', function() {});
+ FS.createDevice('/', 'createDevice-write-only', null, function() {});
FS.createDataFile('/', 'file', '1234567890', true, true);
FS.createFolder('/', 'folder', true, true);
})();
diff --git a/tests/unistd/io.out b/tests/unistd/io.out
index 3061b94e..037d0c34 100644
--- a/tests/unistd/io.out
+++ b/tests/unistd/io.out
@@ -22,6 +22,11 @@ TO DEVICE: 0
write to device: 8
errno: 0
+open read-only device from createDevice for read, errno: 0
+open read-only device from createDevice for write, errno: 13
+open write-only device from createDevice for read, errno: 13
+open write-only device from createDevice for write, errno: 0
+
read from file: 10
data: 1234567890
errno: 0