mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
fs: fix symlink error message
the arguments were swapped, so fs.symlink{Sync,} would report that the wrong file EEXIST'd in error. Fixes: https://github.com/joyent/node/issues/8651 Fixes: https://github.com/joyent/node/issues/4314 Fixes: https://github.com/joyent/node/issues/5381 PR-URL: https://github.com/joyent/node/pull/8657 Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
This commit is contained in:
parent
00d7b13a18
commit
f6556b678d
@ -515,9 +515,9 @@ static void Symlink(const FunctionCallbackInfo<Value>& args) {
|
||||
}
|
||||
|
||||
if (args[3]->IsFunction()) {
|
||||
ASYNC_DEST_CALL(symlink, args[3], *dest, *dest, *path, flags)
|
||||
ASYNC_DEST_CALL(symlink, args[3], *path, *dest, *path, flags)
|
||||
} else {
|
||||
SYNC_DEST_CALL(symlink, *path, *dest, *dest, *path, flags)
|
||||
SYNC_DEST_CALL(symlink, *dest, *path, *dest, *path, flags)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,10 @@ fs.link(existingFile, existingFile2, function(err) {
|
||||
assert.ok(0 <= err.message.indexOf(existingFile2));
|
||||
});
|
||||
|
||||
fs.symlink(existingFile, existingFile2, function(err) {
|
||||
assert.ok(0 <= err.message.indexOf(existingFile2));
|
||||
});
|
||||
|
||||
fs.unlink(fn, function(err) {
|
||||
assert.ok(0 <= err.message.indexOf(fn));
|
||||
});
|
||||
@ -153,6 +157,14 @@ try {
|
||||
assert.ok(0 <= err.message.indexOf(existingFile2));
|
||||
}
|
||||
|
||||
try {
|
||||
++expected;
|
||||
fs.symlinkSync(existingFile, existingFile2);
|
||||
} catch (err) {
|
||||
errors.push('symlink');
|
||||
assert.ok(0 <= err.message.indexOf(existingFile2));
|
||||
}
|
||||
|
||||
try {
|
||||
++expected;
|
||||
fs.unlinkSync(fn);
|
||||
|
Loading…
Reference in New Issue
Block a user