All of lore.kernel.org
 help / color / mirror / Atom feed
* readdir() problems
@ 2004-01-30  3:02 Mark and Janice Juszczec
  2004-01-30 18:47 ` Jun Sun
  0 siblings, 1 reply; 2+ messages in thread
From: Mark and Janice Juszczec @ 2004-01-30  3:02 UTC (permalink / raw)
  To: linux-mips


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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-01-30 18:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-30  3:02 readdir() problems Mark and Janice Juszczec
2004-01-30 18:47 ` Jun Sun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.