[uClibc 0001012]: readdir_r returns previous errno

bugs at busybox.net bugs at busybox.net
Wed Aug 30 14:27:31 UTC 2006


The following issue has been SUBMITTED. 
====================================================================== 
http://busybox.net/bugs/view.php?id=1012 
====================================================================== 
Reported By:                moschny
Assigned To:                uClibc
====================================================================== 
Project:                    uClibc
Issue ID:                   1012
Category:                   Other
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             08-30-2006 07:27 PDT
Last Modified:              08-30-2006 07:27 PDT
====================================================================== 
Summary:                    readdir_r returns previous errno
Description: 
When errno is set to a value!=0, readdir_r() will return the value of errno
as the error value after reading all directory entries.

The relevant code part is this (libc/misc/dirent/readdir_r.c):

                //...
		bytes = __getdents(dir->dd_fd, dir->dd_buf, dir->dd_max);
		if (bytes <= 0) {
		    *result = NULL;
		    ret = errno;
		    goto all_done;
		}
                // ...

If bytes==0, ret should be set to zero and not the (old, and unchanged by
__getdents) errno value. If bytes<0, errno as set by __getdents can be
returned.
====================================================================== 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
08-30-06 07:27  moschny        New Issue                                    
08-30-06 07:27  moschny        Status                   new => assigned     
08-30-06 07:27  moschny        Assigned To               => uClibc          
======================================================================




More information about the uClibc-cvs mailing list