lib/fs/modules/LinuxMount.rb in manageiq-smartstate-0.3.10 vs lib/fs/modules/LinuxMount.rb in manageiq-smartstate-0.4.0
- old
+ new
@@ -307,30 +307,26 @@
# if it's a symbolic link. If so, expand it
# relative to its base directory.
#
components.each do |c|
ncp = File.join(cp, c)
- cp = follow_all_symlinks(ncp)
- end
- cp
- end
-
- def follow_all_symlinks(link_ptr)
- #
- # Each filesystem knows how to check for,
- # and read its own links.
- #
- no_more_links = false
- until no_more_links
- filesys, tmp_link_ptr = getFsPathBase(link_ptr)
- if filesys.fileSymLink?(tmp_link_ptr)
- symlink = getSymLink(filesys, tmp_link_ptr)
- link_ptr = symlink[0, 1] == '/' ? symlink : File.join(File.dirname(link_ptr), symlink)
+ #
+ # Each file system know how to check for,
+ # and read its own links.
+ #
+ fs, lp = getFsPathBase(ncp)
+ if fs.fileSymLink?(lp)
+ sl = getSymLink(fs, lp)
+ if sl[0, 1] == '/'
+ cp = sl
+ else
+ cp = File.join(cp, sl)
+ end
else
- no_more_links = true
+ cp = ncp
end
end
- link_ptr
+ (cp)
end
def getSymLink(fs, p)
fs.fileOpen(p, &:read)
end