Permalink
Browse files

catch recursive symlinks like 'ln -s me me'

  • Loading branch information...
1 parent 90f5f6f commit 69d246eda6f2b1e06dd165dcdec9185f7c0f3b9b @fjakobs fjakobs committed Oct 19, 2012
Showing with 7 additions and 2 deletions.
  1. +5 −0 localfs.js
  2. +1 −1 package.json
  3. +1 −1 test/test-local.js
View
5 localfs.js
@@ -130,6 +130,11 @@ module.exports = function setup(fsOptions) {
return callback(entry);
}
fs.readlink(fullpath, function (err, link) {
+ if (entry.name == link) {
+ entry.linkStatErr = "ELOOP: recursive symlink";
+ return callback(entry);
+ }
+
if (err) {
entry.linkErr = err.stack;
return callback(entry);
View
2 package.json
@@ -6,7 +6,7 @@
],
"name": "vfs-local",
"description": "A vfs implementation that works on the local filesystem.",
- "version": "0.3.7",
+ "version": "0.3.8",
"repository": {
"type": "git",
"url": "git://github.com/c9/vfs-local.git"
View
2 test/test-local.js
@@ -222,7 +222,7 @@ describe('vfs-local', function () {
it("should support 304 via etags", function (done) {
vfs.readdir("/", {head:true}, function (err, meta) {
if (err) throw err;
- expect(meta).property("etag").ok
+ expect(meta).property("etag").ok;
var etag = meta.etag;
vfs.readdir("/", {etag:etag}, function (err, meta) {
if (err) throw err;

0 comments on commit 69d246e

Please sign in to comment.