home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!news.u.washington.edu!stein.u.washington.edu!bungi
- From: bungi@stein.u.washington.edu (Timothy J. Wood)
- Newsgroups: comp.sys.next.bugs
- Subject: Bug in the realpath(3) function
- Message-ID: <1992Dec27.101753.16648@u.washington.edu>
- Date: 27 Dec 92 10:17:53 GMT
- Article-I.D.: u.1992Dec27.101753.16648
- Sender: news@u.washington.edu (USENET News System)
- Organization: University of Washington
- Lines: 39
-
-
- I believe that the following code exhibits a bug in the NeXT
- implementation of the realpath(3) function. I am running NS3.0.
-
- #import <sys/param.h>
- #import <stdio.h>
-
- /*
- * usage: realpath [filelist]
- */
-
- int main (int argc, char *argv[])
- {
- char *file_name;
- char resolved_name[MAXPATHLEN];
- int i = 1;
-
- while (i < argc) {
- if (!realpath(argv[i], resolved_name))
- perror(argv[i]);
- else
- puts(resolved_name);
- i++;
- }
- }
-
-
- The problem involves the clipping of the prefix of some paths, for
- example:
-
- % cd /
- % realpath tmp
- rivate/tmp
- % realpath /tmp
- /private/tmp
- %
-
- Notice that in the first case the leading "/p" was stripped from the
- output. This happens in various other cases as well.
-