From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_40,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f8c9b,372ebe42676183e0 X-Google-Attributes: gidf8c9b,public X-Google-Thread: 103376,372ebe42676183e0 X-Google-Attributes: gid103376,public X-Google-Thread: fc89c,372ebe42676183e0 X-Google-Attributes: gidfc89c,public X-Google-Thread: 1014db,372ebe42676183e0 X-Google-Attributes: gid1014db,public X-Google-ArrivalTime: 1994-12-11 23:55:30 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!gatech!newsxfer.itd.umich.edu!zip.eecs.umich.edu!caen!msunews!harbinger.cc.monash.edu.au!yarrina.connect.com.au!warrane.connect.com.au!troll.apana.org.au!quux.apana.org.au!quux!lr From: lr@quux.apana.org.au (Lachlan Roche) Newsgroups: comp.lang.ada,comp.lang.c,comp.unix.programmer,comp.unix.questions Subject: Re: Filename comparison ... HELP NEEDED! Followup-To: comp.unix.programmer Date: 12 Dec 1994 07:50:57 GMT Organization: We don't need no steenking organisation. Distribution: world Message-ID: References: <3bn13h$jmo@speedy.cci.de> NNTP-Posting-Host: quux.apana.org.au In-reply-to: jewell@cci.de's message of 2 Dec 1994 11:40:33 GMT Xref: bga.com comp.lang.ada:8519 comp.lang.c:34300 comp.unix.programmer:9762 comp.unix.questions:17762 Date: 1994-12-12T07:50:57+00:00 List-Id: In article <3bn13h$jmo@speedy.cci.de> jewell@cci.de (Nigel Jewell) writes: >Does anybody know of an good solution to seeing if two filenames given actually >point at the same file in the file system? (Probably a solution in C). The canonical method is inode comparison. If the inodes are the same, its the same file. eg. /* do these two names refer to a single file? */ int is_alias( char *name1, char *name2 ) { struct stat stat1, stat1; stat( name1, &stat1 ) stat( name2, &stat2 ) return stat1.st_ino == stat2.st_ino; } -- Lachlan Roche ... in Brisbane, Australia ... lr@quux.apana.org.au