thanks Yaman,
the error code it's returning is 12, which is Cannot allocate memory.
I checked the ram there is 2 GB free there, and the folder is not that huge.
On 4/5/07, Yaman Saqqa <[EMAIL PROTECTED]> wrote:
>
> Let's start by modifying the code to check errno after the NULL returns to
> figure out what exactly is the error.
>
> On 4/5/07, Ala'a Ibrahim < [EMAIL PROTECTED]> wrote:
> >
> > Hi All,
> > I'm having this problems, a couple of days ago, one of the servers
> > started to have some problems with readdir, I've written this code to test:
> > #include <sys/types.h>
> > #include <dirent.h>
> > #include <string.h>
> > #include <stdlib.h>
> > #include <stdio.h>
> >
> > int thruDirectories (char *dirName) {
> > DIR *directory;
> > struct dirent *fileData;
> > char newdirname[5000] = "";
> > size_t leng;
> > directory = opendir(dirName);
> > while(fileData = readdir(directory)) {
> > if(fileData->d_name[0] == '.') {
> > continue;
> > }
> > if(fileData->d_type == 4) {
> > leng = strlen(dirName) + strlen(fileData->d_name) + 2;
> > newdirname[0]='\0';
> > strcat(newdirname,dirName);
> > strcat(newdirname,"/");
> > strcat(newdirname,fileData->d_name);
> > fprintf(stderr,"dirname is %s\n" ,newdirname);
> > thruDirectories(newdirname);
> > continue;
> > }
> > fprintf(stderr,"%s/%s\n",dirName,fileData->d_name );
> > }
> > closedir(directory);
> > return 0;
> > }
> >
> > main() {
> > thruDirectories("Desktop");
> > }
> >
> > this code is supposed to go through a directory, parse it's print it's
> > content, if it's a directory, recursively parse it again.
> > now if you are root, everything works fine.
> > any other user, some of the subdirectories would not get parsed due to
> > that readdir is returning NULL the first time it gets in (it even doesn't
> > get the '.' and '..' folders).
> >
> > and yes I've checked the files permissions, ulimit, glibc, and now I'm
> > out of ideas. and the problem only started a couple of days ago, it was
> > running fine before. running the original code on other servers doesn't have
> > a problem
> > anybody have a clue ... please help me out. as now the only solution I
> > have is to back up the server, and reinstall Linux, and I'm hoping not to
> > reach that point.
> >
> > --
> > Ala'a A. Ibrahim
> > http://guru.alaa-ibrahim.com/
> >
> >
>
>
> --
> abulyomon
>
> www.KiLLTHeUPLiNK.com
> >
>
--
Ala'a A. Ibrahim
http://guru.alaa-ibrahim.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Jolug" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Jolug?hl=en-GB
-~----------~----~----~----~------~----~------~--~---