delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/11/16/03:17:34

From: khan AT xraylith DOT wisc DOT edu (Mumit Khan)
Subject: Re: stat() bug?
16 Nov 1998 03:17:34 -0800 :
Message-ID: <Pine.SUN.3.93.981115175623.24218C-100000.cygnus.gnu-win32@modi.xraylith.wisc.edu>
References: <83A5B9068368D211BDE90060B06A21BA261026 AT bozeman DOT pwrh DOT com>
Mime-Version: 1.0
To: "Haynes, Dan" <Haynes AT pwrh DOT com>
Cc: gnu-win32 AT cygnus DOT com

On Sun, 15 Nov 1998, Haynes, Dan wrote:

> Greetings,
> 
>   I don't know if this is expected behaviour under Unix or not (I'm an NT
> kind of guy) but I think this is a bug: stat() with an empty file name
> returns 0. This is reproducible with:
> 
> #include <sys/stat.h>
> 
> int main( void )
> {
> int rc ;
> struct stat	statBuffer ;
> 
>   rc = stat( "", &statBuffer ) ;
>   return ( 0 ) ;
> }
> 
> When compiled with gcc 2.7-B19, rc is 0. The same code compiled with Borland
> C++ V5.02 returns -1.
> 
> Is this a Unix-ism, or did I find an oops?

It's a bug in winsup, specifically in mount_info::conv_to_win32_path. 
In this case, POSIX says that stat() returns -1 and errno is set to 
ENOENT ("No such file or directory"). I'll send a possible fix to 
cygwin folks for consideration.

Note that the error conditions returned by stat is limited in POSIX, 
and I've seen code fail that expect SVR4 behaviour (much larger set).

Regards,
Mumit


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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