Christopher Gorski wrote: > I noticed that the first calls in the "cp" and "ls" to getdents() return > similar file lists, with the same values. > > However, in the "ls", it makes a second call to getdents():
If this is Sun's cp, file a bug. It's failing to notice that it didn't provide a large enough buffer to getdents(), so it only got partial results. Of course, the getdents() API is rather unfortunate. It appears the only safe algorithm is: while ((r = getdents(...)) > 0) { /* process results */ } if (r < 0) { /* handle error */ } You _always_ have to call it at least twice to be sure you've gotten everything. -- Carson _______________________________________________ zfs-discuss mailing list zfs-discuss@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/zfs-discuss