[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug or feature? checking type of readdir fails
From: |
Ville Salomäki |
Subject: |
Bug or feature? checking type of readdir fails |
Date: |
Sun, 29 Aug 2010 17:34:41 +0300 |
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
address@hidden
- Bug or feature? checking type of readdir fails,
Ville Salomäki <=