Hello

I was trying to compile php on a gentoo, but it failed for "too few
arguments to readdir_r".
After narrowing down the problem, I came up with user privileges:

ac_cv_func_readdir_r compiles and runs the following code:

 #define _REENTRANT
 #include <sys/types.h>
 #include <dirent.h>

 #ifndef PATH_MAX
 #define PATH_MAX 1024
 #endif

 main() {
   DIR *dir;
   char entry[sizeof(struct dirent)+PATH_MAX];
   struct dirent *pentry = (struct dirent *) &entry;

   dir = opendir("/");
   if (!dir)
     exit(1);
   if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0)
     exit(0);
   exit(1);
 }


Problem is the opendir("/"), which gives 'false' result when the package
handler doesnt have read privileges to root. Giving read privileges fixes
the issue.
Is this intentional?

Ville Salomäki
vsalom...@gmail.com

Reply via email to