> -----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. > > 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
