Hi folks
I'm running on a Helio pda, r3912 chip, little endian. I've used crosstool
to create a cross compiler with
gcc 3.2.3
glibc 2.2.3
When I run the following code (linked static or dynamic):
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
main(int argc, char **argv){
DIR* dir;
struct dirent* entry;
int len;
int hlen;
char* name;
char* buf;
printf("in dirtest main()\n");
fprintf(stderr,"in dirtest main()\n");
dir = opendir("/bin");
if (dir == 0) {
fprintf(stderr,"opendir returned 0\n");
}
else{
fprintf(stderr,"opendir returned dir=%x\n",dir);
}
entry=readdir(dir);
fprintf(stderr,"after readdir\n");
printf("errno=%d\n",errno);
if (entry != 0){
fprintf(stderr,"entry=%x\n",entry);
name = entry->d_name;
fprintf(stderr,"name=%s\n",name);
while ((entry = readdir(dir)) != 0) {
name = entry->d_name;
fprintf(stderr,"name=%s\n",name);
}
}
else{
fprintf(stderr,"readdir failed and you can't reference entry\n");
}
closedir(dir);
}
I get the following output:
/bin # ./dirtest
in dirtest main()
opendir returned dir=100000c8
I can only assume its crashing after entry=readdir(dir)
Does anyone know of any readdir() problems in linux-mips world?
Mark
_________________________________________________________________
Learn how to choose, serve, and enjoy wine at Wine @ MSN.
http://wine.msn.com/
|