From: <no...@so...> - 2001-06-07 22:38:12
|
Bugs item #227383, was updated on 2001-01-03 01:54 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=102435&aid=227383&group_id=2435 Category: None Group: None >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Hervé PARISSI (hparissi) >Assigned to: Earnie Boyd (earnie) Summary: opendir() failed (mingw-runtime-0.4-20001204) Initial Comment: This test program doesn't work (under win2k at least) : <BEGIN tstopendir.c> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <limits.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> #if defined(__MINGW32__)||defined(__CYGWIN__)||defined(_unix) #include <unistd.h> #endif #include <dirent.h> // Mingw32 doesn't seem to have S_IFLNK defined #if !defined(S_IFLNK) # define S_IFLNK 0xa000 #endif #if !defined(PATH_MAX) #define PATH_MAX 254 #endif int proc(const char *szDirPath) { char cType, fname[PATH_MAX], str[PATH_MAX]; DIR *pDir; struct dirent *pDirent; struct stat Stat; printf("tstopendir : opendir(\%s\)\n",szDirPath); // opendir() gives an errno=2 if the path has an / or \ at // the end, else it gives a segfault pDir=opendir(szDirPath); printf("opendir returned %s\n",pDir?"true":"false"); if(!pDir) { fprintf(stderr,"%s: can't opendir (errno=%u=0x%0x)\n", szDirPath,errno,errno); return 2; } for(*fname=0;;) { pDirent=readdir(pDir); if(!pDirent) break; strcpy(fname,pDirent->d_name); // Ask for more informations about the file sprintf(str,"%s/%s",szDirPath,fname); stat(str,&Stat); if(Stat.st_mode&S_IFDIR) cType='d'; else if(Stat.st_mode&S_IFREG) cType='-'; else if(Stat.st_mode&S_IFLNK) cType='l'; else cType='?'; printf("%c %12lu %s\n",cType,Stat.st_size,fname); } closedir(pDir); return 0; } int main(int argc,char **argv) { if(argc!=2) { fprintf(stderr,"usage: %s path",argv[0]); return 1; } return proc(argv[1]); } <END tstopendir.c> ---------------------------------------------------------------------- Comment By: Hervé PARISSI (hparissi) Date: 2001-04-12 10:53 Message: Logged In: YES user_id=25461 Hi, no it's no more an issue, it only failed with mingw- runtime-0.4-20001204, I never understood why. So you can consider this case closed! ---------------------------------------------------------------------- Comment By: Earnie Boyd (earnie) Date: 2001-04-11 18:33 Message: Logged In: YES user_id=15438 Is this still an issue??? Earnie. ---------------------------------------------------------------------- Comment By: Hervé PARISSI (hparissi) Date: 2001-02-02 00:06 Message: Now it works back with mingw-runtime-0.4.tar.gz ! ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=102435&aid=227383&group_id=2435 |