stat()/lstat() problem (?)

ZXPLESPAC001, Ext ext.zxplespac001@astrium.eads.net
Wed Apr 28 09:25:00 GMT 2004


	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 >
-------------- next part --------------
---------------------------------------------------------

CE COURRIER ELECTRONIQUE EST A USAGE STRICTEMENT INFORMATIF ET NE SAURAIT ENGAGER DE QUELQUE MANIERE QUE CE SOIT EADS ASTRIUM SAS, NI SES FILIALES.

SI UNE ERREUR DE TRANSMISSION OU UNE ADRESSE ERRONEE A MAL DIRIGE CE COURRIER, MERCI D'EN INFORMER L'EXPEDITEUR EN LUI FAISANT UNE REPONSE PAR COURRIER ELECTRONIQUE DES RECEPTION. SI VOUS N'ETES PAS LE DESTINATAIRE DE CE COURRIER, VOUS NE DEVEZ PAS L'UTILISER, LE CONSERVER, EN FAIRE ETAT, LE DISTRIBUER, LE COPIER, L'IMPRIMER OU EN REVELER LE CONTENU A UNE TIERCE PARTIE.



This email is for information only and will not bind EADS Astrium SAS in any contract or obligation, nor its subsidiaries.

If you have received it in error, please notify the sender by return email. If you are not the addressee of this email, you must not use, keep, disseminate, copy, print or otherwise deal with it.

---------------------------------------------------------

-------------- next part --------------
--
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/


More information about the Cygwin mailing list