[uClibc 0001012]: readdir_r returns previous errno

bugs at busybox.net bugs at busybox.net
Sat Sep 15 09:24:58 UTC 2007


The following issue has been CLOSED 
====================================================================== 
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:                     closed
Resolution:                 fixed
Fixed in Version:           
====================================================================== 
Date Submitted:             08-30-2006 07:27 PDT
Last Modified:              09-15-2007 02:24 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.
====================================================================== 

---------------------------------------------------------------------- 
 moschny - 08-30-06 13:52  
---------------------------------------------------------------------- 
This is a quick and dirty patch to get things working for me. Maybe there
are cleaner solutions. 

---------------------------------------------------------------------- 
 vapier - 09-15-07 02:24  
---------------------------------------------------------------------- 
should be fixed in current trunk now, thanks for the patch 

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          
08-30-06 13:51  moschny        File Added: 100-readdir_r.patch                  
 
08-30-06 13:52  moschny        Note Added: 0001599                          
09-15-07 02:24  vapier         Note Added: 0002750                          
09-15-07 02:24  vapier         Status                   assigned => closed  
09-15-07 02:24  vapier         Resolution               open => fixed       
======================================================================




More information about the uClibc-cvs mailing list