-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Filippo ARCIDIACONO wrote: > > >> -----Original Message----- >> From: [email protected] >> [mailto:[email protected]] On Behalf Of Kovesdi Gyorgy >> Sent: Wednesday, March 25, 2009 9:49 AM >> To: [email protected] >> Subject: problem with errno in readdir64_r() and readdir_r() >> >> Hi, >> >> I found that the above mentioned functions can return with >> strange error values in some cases: it is possible to return >> the previous value of the 'errno' without modifying it. >> e.g. the 'svn' executable reports strange errors due to this bug. > If there is a bug you should provide a simlpe test case that raise the > problem. >> Those functions contain this code: >> >> bytes = __getdents64(dir->dd_fd, dir->dd_buf, dir->dd_max); >> if (bytes <= 0) { >> *result = NULL; >> ret = (bytes==0)? 0 : errno; >> goto all_done; >> ... >> >> AFAIK the functions __getdents64() and __getdents() return >> zero at the end of the directory, and the 'errno' is not >> modified in this case (because it is not an error), so the >> previous value of 'errno' can be returned by these functions. >> I suggest a modification: >> >> bytes = __getdents64(dir->dd_fd, dir->dd_buf, dir->dd_max); >> if (bytes == 0) { >> *result = NULL; >> ret = 0; >> goto all_done; >> } else if (bytes < 0) { >> *result = NULL; >> ret = (bytes==0)? 0 : errno; >> goto all_done; >> ... > Sorry, but I cannot see any distinction with the previous one.
Moreover, looking at >> ret = (bytes==0)? 0 : errno; ret will be set to errno only if < 0, isn't it ? are we missing/misunderstanding something in what you said ? if so, as FIlippo suggested, a simple test case will be helpful. Cheers, Carmelo >> or something similar. I did not test it, because it is too >> complicated for me to recompile the whole uClibc. It is just an idea. >> >> Regards >> K. Gy. >> _______________________________________________ >> uClibc mailing list >> [email protected] >> http://lists.busybox.net/mailman/listinfo/uclibc >> > > _______________________________________________ > uClibc mailing list > [email protected] > http://lists.busybox.net/mailman/listinfo/uclibc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAknKLTsACgkQoRq/3BrK1s9TKACgsDX6k/c0bMrAHcfUHNUzJryq yvkAoPrnrnqQJfmYMzOHHdeFL+z6cMph =BL+M -----END PGP SIGNATURE----- _______________________________________________ uClibc mailing list [email protected] http://lists.busybox.net/mailman/listinfo/uclibc
