[pacman-dev] [PATCH] Drastically reduce the number of syscalls.

Allan McRae allan at archlinux.org
Wed Aug 4 00:45:50 EDT 2010


On 27/07/10 00:17, Tim Nieradzik wrote:
> ---
>   lib/libalpm/be_files.c |   18 ++----------------
>   1 files changed, 2 insertions(+), 16 deletions(-)
>
> diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
> index adf41aa..ddef742 100644
> --- a/lib/libalpm/be_files.c
> +++ b/lib/libalpm/be_files.c
> @@ -113,8 +113,6 @@ static int dirlist_from_fs(const char *syncdbpath, alpm_list_t **dirlist)
>   {
>   	DIR *dbdir;
>   	struct dirent *ent = NULL;
> -	struct stat sbuf;
> -	char path[PATH_MAX];
>
>   	dbdir = opendir(syncdbpath);
>   	if (dbdir != NULL) {
> @@ -128,8 +126,7 @@ static int dirlist_from_fs(const char *syncdbpath, alpm_list_t **dirlist)
>   			}
>
>   			/* stat the entry, make sure it's a directory */
> -			snprintf(path, PATH_MAX, "%s%s", syncdbpath, name);
> -			if(stat(path,&sbuf) != 0 || !S_ISDIR(sbuf.st_mode)) {
> +			if(ent->d_type != DT_DIR) {


That is a platform specific construct (not defined by POSIX).  It works 
with glibc (not sure about uclibc) and on BSD libc, but I believe this 
broken on OSX and potentially on broken cygwin.  And those are only the 
platforms I know people are using pacman on...

Any ideas if we can autoconf around that?

Allan


More information about the pacman-dev mailing list