delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/07/07/20:11:02

From: Eric Backus <ericb AT lsid DOT hp DOT com>
Subject: Re: stat("/") fails
To: dj AT ctron DOT com
Date: Tue, 7 Jul 92 16:28:48 PDT
Cc: ericb AT lsid DOT hp DOT com, djgpp AT sun DOT soe DOT clarkson DOT edu
Mailer: Elm [revision: 66.25]

> >I have found that stat() fails when trying to stat the root directory
> >"/".  I have tried the following combinations:
> 
> >	stat("/", &buf);
> >	stat("/.", &buf);
> >	stat("c:/", &buf);
> 
> >All of these fail, and set errno to 2 (file not found).  Does anyone
> >know why?  Does anyone know how to fix this, or at least a workaround?
> 
> Try it with Turbo-C.  I bet it doesn't work there either, since the
> root directory isn't really a "file" per se (it doesn't exist in
> another directory's file listing).

It isn't a file, and it doesn't exist in another directory's file
listing, but it IS a directory.  I bet you're right about it not
working with Turbo-C.  But it certainly works on UNIX, and if anyone
knows a good workaround for this on DOS, I'd like to see it.

Seems like we could have the stat() function examine the first
argument.  If it's the root directory, fill in the stat buffer
appropriately and then return it.  If it's not the root directory,
jump to "turbo_assist" and let Turbo-C handle it.  Maybe I'll give
this some work tonight.
--
				Eric Backus
				ericb%hplsla AT hplabs DOT hp DOT com
				(206) 335-2495

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019