Carson Gaspar wrote: > 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. >
Yes, it is Sun's cp. I'm trying, with some difficulty, to figure out exactly how to reproduce this error in a way not specific to my data. I copied a set of randomly generated files with a deep directory structure and cp seems to correctly call getdents() multiple times. -Chris _______________________________________________ zfs-discuss mailing list zfs-discuss@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/zfs-discuss