🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.next.bugs
1 messages
1 total messages Started by Timothy J. Wood Sun, 27 Dec 1992 10:17
Bug in the realpath(3) function
#4
Author: Timothy J. Wood
Date: Sun, 27 Dec 1992 10:17
39 lines
1306 bytes
  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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads