From a48537c245151810e33b7ab9915b5f0b9ea9e75f Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 1 Oct 2007 23:33:03 +0200 Subject: [PATCH] for_each_file_in_dir(): Ignore permission errors for subdirectories. --- osl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osl.c b/osl.c index 6e3eeca6..0b14447b 100644 --- a/osl.c +++ b/osl.c @@ -211,9 +211,10 @@ out: * \param func The function to call for each entry. * \param private_data Pointer to an arbitrary data structure. * - * For each regular file in \a dirname, the supplied function \a func is + * For each regular file under \a dirname, the supplied function \a func is * called. The full path of the regular file and the \a private_data pointer - * are passed to \a func. + * are passed to \a func. Directories for which the calling process has no + * permissions to change to are silently ignored. * * \return On success, 1 is returned. Otherwise, this function returns a * negative value which indicates the kind of the error. @@ -226,7 +227,7 @@ int for_each_file_in_dir(const char *dirname, int cwd_fd, ret2, ret = para_opendir(dirname, &dir, &cwd_fd); if (ret < 0) - return ret; + return ret == -E_CHDIR_PERM? 1 : ret; /* scan cwd recursively */ while ((entry = readdir(dir))) { mode_t m; -- 2.39.5