
Loading…
exporting through symlinks/stat vs lstat in diod_walk() #17
Merged
+1
−1
pipcet
commented
|
|
pipcet |
use stat() rather than lstat() to decide whether a directory entry is a
…
mount point. if /link is a link to a directory on a different file system, lstat(/link) and lstat(/link/file) have different .st_devs, even though /link/file is an ordinary file in a symlinked directory; stat(/link) and lstat(/link/file) have the same .st_devs, so I believe we should be testing that condition instead. |
299e16b
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Commits on Apr 18, 2015
-
use stat() rather than lstat() to decide whether a directory entry is a …
pipcet authoredmount point. if /link is a link to a directory on a different file system, lstat(/link) and lstat(/link/file) have different .st_devs, even though /link/file is an ordinary file in a symlinked directory; stat(/link) and lstat(/link/file) have the same .st_devs, so I believe we should be testing that condition instead.
This page is out of date. Refresh to see the latest.
Hi,
this (single-character) change fixes a problem for me when exporting through a symlink to a directory on a different file system. If "link" is such a symlink, lstat("link") and lstat("link/file") will have different device ids; that makes diod_walk call _statmnt("link/file"), which tries to stat("link/file/.."), which fails with ENOTDIR:
I believe the correct thing to do is to stat(f->path), which follows the symlink and returns the same device as lstat(npath) if the latter is a file residing in f.