aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormanuels <manuel.schoelling@gmx.de>2013-05-15 18:54:48 +0200
committermanuels <manuel.schoelling@gmx.de>2013-05-15 18:54:48 +0200
commitcd3320992885c2f5fdd4f10b058c6d633d26cb74 (patch)
tree7a044f6c5a526735042b4c4ce1d0cb0b004b6b90
parent4e72ab4bd5cbf987e08d0ca72bef4292e5870d8e (diff)
Fix bug in rename() that occures if new filename starts with the old filename
-rw-r--r--src/library.js3
-rwxr-xr-xtests/runner.py6
2 files changed, 6 insertions, 3 deletions
diff --git a/src/library.js b/src/library.js
index aaef2f74..53f0a34b 100644
--- a/src/library.js
+++ b/src/library.js
@@ -3454,8 +3454,7 @@ LibraryManager.library = {
___setErrNo(ERRNO_CODES.EBUSY);
return -1;
} else if (newObj.parentPath &&
- newObj.parentPath.indexOf(oldObj.parentPath) == 0 &&
- newObj.parentPath != oldObj.parentPath) {
+ newObj.parentPath.indexOf(oldObj.path) == 0) {
___setErrNo(ERRNO_CODES.EINVAL);
return -1;
} else if (newObj.exists && newObj.object.isFolder) {
diff --git a/tests/runner.py b/tests/runner.py
index 838c150d..8ed42143 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -3414,6 +3414,7 @@ Exiting setjmp function, level: 0, prev_jmp: -1
FILE* fid;
err = mkdir("/foo", 0777);
+ err = mkdir("/bar", 0777);
fid = fopen("/foo/bar", "w+");
fclose(fid);
@@ -3422,10 +3423,13 @@ Exiting setjmp function, level: 0, prev_jmp: -1
err = rename("/foo", "/foo/foo");
printf("%d\\n", err);
+
+ err = rename("/foo", "/bar/foo");
+ printf("%d\\n", err);
return 0;
}
'''
- self.do_run(src, '0\n-1\n', force_c=True)
+ self.do_run(src, '0\n-1\n0\n', force_c=True)
def test_alloca_stack(self):
if self.emcc_args is None: return # too slow in other modes