This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

stat()/lstat() problem (?)


	Hi,

here is my question/problem (see the example program below):
-----//--------
#include <stdio.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>

static int is_dir(char * dr)
{
        struct stat st;

        if(stat(dr, &st) == -1)
        {
                perror("stat");
                return -1;

        }
        if(lstat(dr, &st) == -1)
        {
                perror("lstat");
                return -1;

        }
}
int main(int argc,char **argv)
{
        int rc;

        rc=is_dir("//bin");
        rc=is_dir("/bin");
}
-----//--------

With my version of cygwin(Windows NT Ver 4.0 Build 1381 Service Pack 6 -
cygwin 1.5.9-1) 
the first call to is_dir() produces an error(stat: No such file or
directory)
BUT the same code was compiled and run on Linux (RH9) and Sun (Solaris2.8)
and
produces no errors !!

The question is:
- is the behavior on Linux/Solaris normal ? I fact there ain't a '//bin'
only a '/bin',
but even all the shells treat them as representing the same path (BTW 'cd
//bin' on 
cygwin/bash doesn't work ...)
- is it an error in cygwin ? Did all pathes (oops is my english very clear
?) have to
treat dupplicated '/' as single '/' ? Is the notion of a pathname normalized
somewhere
(maybe posix ?) ?

-- 
	Eric Lassauge <lassauge-NOSPAM AT users.sourceforge.net >

Attachment: important_notice.txt
Description: Text document

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]