Fix #294 - Failure to unlink directories should return an EPERM error

This commit is contained in:
gideonthomas 2014-09-24 11:22:29 -04:00
parent af5eea103a
commit 8c00b856bc
3 changed files with 3 additions and 3 deletions

View File

@ -54,7 +54,7 @@ var errors = {};
'47:EEXIST:file already exists',
//'48:ESRCH:no such process',
//'49:ENAMETOOLONG:name too long',
//'50:EPERM:operation not permitted',
'50:EPERM:operation not permitted',
'51:ELOOP:too many symbolic links encountered',
//'52:EXDEV:cross-device link not permitted',
'53:ENOTEMPTY:directory not empty',

View File

@ -1044,7 +1044,7 @@ function unlink_node(context, path, callback) {
if(error) {
callback(error);
} else if(result.mode === 'DIRECTORY') {
callback(new Errors.EISDIR('unlink not permitted on directories', name));
callback(new Errors.EPERM('unlink not permitted on directories', name));
} else {
update_file_node(null, result);
}

View File

@ -91,7 +91,7 @@ describe('fs.unlink', function() {
fs.unlink('/mydir', function (error) {
expect(error).to.exist;
expect(error.code).to.equal('EISDIR');
expect(error.code).to.equal('EPERM');
fs.stat('/mydir', function (error, stats) {
expect(error).not.to.exist;