Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!bagate!cbmvax!jesup From: jesup@cbmvax.commodore.com (Randell Jesup) Newsgroups: comp.sys.amiga.programmer Subject: Re: Checking to see if a file's a link Message-ID: <21539@cbmvax.commodore.com> Date: 14 May 91 06:24:15 GMT References: <15127@darkstar.ucsc.edu> Reply-To: jesup@cbmvax.commodore.com (Randell Jesup) Organization: Commodore, West Chester, PA Lines: 38 In article mwm@pa.dec.com (Mike (My Watch Has Windows) Meyer) writes: >Yeah - check DirEntryType (or whatever you check to see if it's a >directory). If the absolute value is 4, it's a link. This data is from >my faulty memory, so you should build a link and check the value. >I am sure that it's a single absolute value, though. See the values posted here earlier (hard links to dirs and files have different values). Note: you can ONLY check for this if you examine the directory it's in and get to it via ExNext (or use ExAll()). Once you've locked it, it has no idea how you got to the object anymore (and ParentDir may not take you where your think!) Ditto for Open(), etc. > On a related topic, will the release version of Workbench 2.x have this > sort of protection built into it's recursive commands (like dir)? > Currently, if I have a directory 'foo', with a link to it's parent > directory, and I do a 'dir foo all', dir ends up going in circles. > >Last time I reported this bug, I was told that they were going to >"fix" the problem by having makelink not allow circular links. That >this implied searching the entire subtree beneath the link didn't seem >to bother the person who posted that fix. Well, that fix is still in (with an override). For 2.04 release, there's also protection against ILooped hardlinks in MatchNext - it refuses to actually enter hardlinked dirs when doing an "ALL" operation (they appear empty). This can be over-ridden via an "I really know what I'm doing" bit. This does not protect you if you roll your own "ALL" via ExNext/Lock/etc, or when running 1.3 commands (which don't use MatchNext). -- Randell Jesup, Keeper of AmigaDos, Commodore Engineering. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com BIX: rjesup Disclaimer: Nothing I say is anything other than my personal opinion. Thus spake the Master Ninjei: "To program a million-line operating system is easy, to change a man's temperament is more difficult." (From "The Zen of Programming") ;-)