On Tue, Jun 09, 2009 at 05:32:08PM -0400, Peter Jones wrote: > > + while(1) { > > + struct dirent *d; > > > > - while ((d = readdir(dir))) { > > errno = 0; > > + if (!(d = readdir(dir))) { > > + if (errno) { > > + printf("error reading from %s: %m\n", dirName); > > + goto done; > > + } > > This needs to check if d == 0 and if d == -1 separately, or at least <= 0 > rather than "!", or we miss actual errors if they occur. this is not readdir syscall -- I guess you read "man readdir" on Fedora, but "man 3 readdir" is better. Yeah, we have confusing docs... RETURN VALUE On success, readdir() returns a pointer to a dirent structure. If the end of the directory stream is reached, NULL is returned and errno is not changed. If an error occurs, NULL is returned and errno is set appropriately. Karel -- Karel Zak <kzak@xxxxxxxxxx> -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html