ftw() and AustinDraft

Thorsten Kukuk kukuk@suse.de
Mon Dec 10 13:43:00 GMT 2001


Hi,

The AustinDraft writes, that ftw should not return (-1) on 
EACCESS errors.

But there are 2 exceptions which we do ignore in the moment:

1. If one component of the "path" is not searchable for the user,
   we should return -1.
2. If the file has no read permissions for the user, we should
   return -1.

I have a small patch for this which works with all of my test cases
(LSB.os test suite). But I'm not sure if it is really correct, there
are to much other cases which I could break.

  Thorsten

-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE GmbH            Deutschherrenstr. 15-19       D-90429 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B
-------------- next part --------------
2001-12-10  Thorsten Kukuk  <kukuk@suse.de>

	* io/ftw.c (ftw_startup): Check, if the path is search and
	readable.

--- io/ftw.c
+++ io/ftw.c	2001/12/10 14:18:23
@@ -473,6 +473,9 @@
       return -1;
     }
 
+  if (access (dir, R_OK) != 0)
+    return -1;
+
   data.maxdir = descriptors < 1 ? 1 : descriptors;
   data.actdir = 0;
   data.dirstreams = (struct dir_data **) alloca (data.maxdir


More information about the Libc-alpha mailing list