[alt.msdos.programmer] Possible bug in Turbo C 2.0 stat

jsilva@cogsci.berkeley.edu (John Silva) (08/24/89)

I have run into what may be a bug in the stat() function in Turbo C 2.0's
libraries.  It seems that if you pass the root directory (/) to stat(), it 
returns a "does not exist" error.  Any other directory or file returns
correctly.  This behavior is present in all of Turbo's libraries.

I have checked my code using Microsoft C 5.1, and stat functions correctly
under the same conditions.

Since my manuals state stat() "returns status on any file, directory, or 
device", I can only assume that Turbo's implementation is in error.

Does anyone know if there is a fix or workaround to this problem, or at the
very least, can confirm it on another machine?

I have applied the TLIB patches, and the tiny model stat() patch, but can't
find any other patches (I don't have access to Compu$erve).

Thanks in advance.

-J.

John P. Silva                                 "I drank WHAT?!"
Inova Products, Inc.                 Internet: jsilva@cogsci.berkeley.edu
(415)222-9255                          Usenet: ucbvax!cogsci!jsilva

craigb@hp-sdd.hp.com (Craig Bosworth) (08/25/89)

I wrote a little test for stat().  It looks like you can use it on any
directory except the root.

  stat("\\", &statbuf);        fails
  stat("c:\\", &statbuf);      fails
  stat(".", &statbuf);         succeeds, except when current directory is root

This may be because there is no entry for the root directory.  Maybe stat only
works on structures that have a directory entry.

BOS
-- 
Craig Bosworth  (619) 592-8609           16399 West Bernardo Drive
Hewlett-Packard, San Diego Division      San Diego, CA  92127-1899
UUCP     : {hplabs|nosc|hpfcla|ucsd}!hp-sdd!craigb
Internet : craigb%hp-sdd@hp-sde.sde.hp.com (or @nosc.mil, @ucsd.edu)