> ! fd = open (filename, O_RDONLY);
> ! if (fd < 0)
> return NULL;
>
> ! if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode))
> ! {
> ! errno = ENOTDIR;
> ! return NULL;
> ! }You're leaking fd here. Same for open(). Paolo
