Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <17F5FEED8AA6D41185B100508BAF1B0608E3EEC1@meteor.tls.fr.astrium.corp> From: "ZXPLESPAC001, Ext" Reply-To: lassauge AT users DOT sourceforge DOT net To: "'cygwin AT sources DOT redhat DOT com'" Subject: stat()/lstat() problem (?) Date: Wed, 28 Apr 2004 11:18:40 +0200 MIME-Version: 1.0 Content-type: multipart/mixed; boundary="=_IS_MIME_Boundary" --=_IS_MIME_Boundary Content-Type: text/plain; charset="ISO-8859-1" Hi, here is my question/problem (see the example program below): -----//-------- #include #include #include #include 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 --=_IS_MIME_Boundary Content-Type: text/plain;charset=us-ascii; name="important_notice.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="important_notice.txt" --------------------------------------------------------- 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. --------------------------------------------------------- --=_IS_MIME_Boundary Content-Type: text/plain; charset=us-ascii -- 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/ --=_IS_MIME_Boundary--