PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs323] Trailing slash makes symlink appear to be directory
Date: Thursday, 17 Sep 2020, 08:50:03


    > Message Posted By: Unknown
    >
    > I am a bit confused as to how to handle a filename such as:
    > /c/cs323/Hwk1/Tests/Root/bravo/hotel/, which is a symbolic link.
    > Because of the trailing slash, however, if I run
    > stat /c/cs323/Hwk1/Tests/Root/bravo/hotel/, it shows that it is
    > a directory. Thus, something like S_ISLNK(buf.st_mode) will not
    > return that it is a symbolic link.

Linux has the following convention:

  If L is the name of a symbolic link that points to a
  directory, then the filename L/ is treated as the name
  of the directory, NOT the name of the link.

--Stan-
PREV INDEX NEXT