Thanks. that should be better now.
On Thu, Feb 26, 2015 at 8:17 AM, Raimund Steger <rs@xxxxxxxx> wrote:
Hi,
there is still a problem. d_name gets cut off, hence stat won't find the file.
I believe it's this:
[...]
p = (struct dirent *) malloc (sizeof (struct dirent));
memcpy (p, dent, sizeof (struct dirent));
According to [1], d_name is indeed variable size though might be defined to size 1 in headers, so copying sizeof(struct dirent) with memcpy will likely not work.
It seems most platforms have a (non-standard) d_reclen field, but the portable way would probably be to add strlen(d_name) before any copying is done.
-Raimund
[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/dirent.h.html
--
Worringer Str 31 Duesseldorf 40211 DE home: <rs@xxxxxxxx>
+49-179-2981632 icq 16845346 work: <rs@xxxxxxxxxxxxxxx>
Akira TAGOH
_______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/fontconfig