summaryrefslogtreecommitdiff
path: root/file_io/unix/dir.c
diff options
context:
space:
mode:
authorWilliam A. Rowe Jr <wrowe@apache.org>2001-01-24 16:16:35 +0000
committerWilliam A. Rowe Jr <wrowe@apache.org>2001-01-24 16:16:35 +0000
commitc61769034c5823c1b8635318b6dc596c667c3212 (patch)
tree1f6e40c2ef155921899f3a33fb3c877bbef8ff58 /file_io/unix/dir.c
parent196b1d844b3935f4e69e1d19cdf619e0fab085d2 (diff)
downloadapr-c61769034c5823c1b8635318b6dc596c667c3212.tar.gz
The last patch to unix/filestat.c added the APR_INCOMPLETE. This patch
teaches apr_dir_read to respect that result and return it itself. Proposed by: Greg Stein git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@61117 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/unix/dir.c')
-rw-r--r--file_io/unix/dir.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/file_io/unix/dir.c b/file_io/unix/dir.c
index 7aa874e02..82784e6bc 100644
--- a/file_io/unix/dir.c
+++ b/file_io/unix/dir.c
@@ -147,8 +147,10 @@ apr_status_t apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
return ret;
}
- /* What we already know */
- /* XXX: Optimize here with d_fileno, d_type etc by platform */
+ /* What we already know - and restrict the wanted test below to stat
+ * only if stat will give us what this platform supports, and we can't
+ * get it from the platform.
+ * XXX: Optimize here with d_fileno, d_type etc by platform */
wanted &= ~(APR_FINFO_NAME);
if (wanted)
{
@@ -162,15 +164,28 @@ apr_status_t apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
/* ??? Or lstat below? What is it we really want? */
ret = apr_stat(finfo, fspec, wanted, thedir->cntxt);
}
- if (!wanted || ret) {
+
+ if (wanted && (ret == APR_SUCCESS || ret == APR_INCOMPLETE)) {
+ wanted &= ~finfo->valid;
+ ret = APR_SUCCESS;
+ }
+ else {
+ /* We don't bail because we fail to stat, when we are only -required-
+ * to readdir... but the result will be APR_INCOMPLETE
+ */
finfo->cntxt = thedir->cntxt;
finfo->valid = 0;
}
+
/* We passed a stack name that is now gone */
finfo->fname = NULL;
finfo->valid |= APR_FINFO_NAME;
/* XXX: Optimize here with d_fileno, d_type etc by platform */
finfo->name = thedir->entry->d_name;
+
+ if (wanted)
+ return APR_INCOMPLETE;
+
return APR_SUCCESS;
}