From: Andre Noll Date: Mon, 1 Oct 2007 21:33:03 +0000 (+0200) Subject: for_each_file_in_dir(): Ignore permission errors for subdirectories. X-Git-Tag: v0.3.0~317^2~1 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=a48537c245151810e33b7ab9915b5f0b9ea9e75f;p=paraslash.git for_each_file_in_dir(): Ignore permission errors for subdirectories. --- 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;