Re: chdir() in VSTa 1.3.3 libc always returns 0

From: Andrew Valencia <vandys_at_nospam.org>
Date: Sun Apr 09 1995 - 16:28:38 PDT

[Calvin Clark <calvin@charlesview.com> writes:]

>I was trying to write a simple "find" utility because I didn't have a
>port handy and I was getting tired of trying to find files by hand.
>I noticed that chdir() always returns 0, even if you try to go to
>a directory that doesn't exist. A brief glance at the definition in
>libc/open.c shows that in fact this is the case. There's also an
>open_c.vim file in the distribution, which suggests someone was
>hacking on the file at the time.

FWIW, I have a port of "rh"; it runs much like "find", but uses a C-like
syntax. It's in the 1.3.3 distribution.

>I'll patch it up in my own sources but I was wondering if there is an
>"official" fix that has been adopted for this.

The problem is harder than you think. Because the mount table is lexical,
you could have something mounted as /usr/local/bin, but nothing specifically
mounted as /usr or /usr/local. So if you chdir to /usr, and then local, and
then bin, it's "reasonable" from an intuitive sense, although there's no
real filesystem with a real directory at the intermediate points.

Our Bourne shell (/vsta/bin/sh) does a reasonably good job in its "cd"
command behavior. It might make a starting point.

                                                Andy
Received on Sun Apr 9 15:41:26 1995

This archive was generated by hypermail 2.1.8 : Thu Sep 22 2005 - 15:12:27 PDT