summaryrefslogtreecommitdiff
path: root/file_io/unix/filestat.c
diff options
context:
space:
mode:
Diffstat (limited to 'file_io/unix/filestat.c')
-rw-r--r--file_io/unix/filestat.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/file_io/unix/filestat.c b/file_io/unix/filestat.c
index 98ef74ec7..dd8b3adf9 100644
--- a/file_io/unix/filestat.c
+++ b/file_io/unix/filestat.c
@@ -100,6 +100,28 @@ static void fill_out_finfo(apr_finfo_t *finfo, struct_stat *info,
*/
}
+apr_status_t apr_file_info_get_locked(apr_finfo_t *finfo, apr_int32_t wanted,
+ apr_file_t *thefile)
+{
+ struct_stat info;
+
+ if (thefile->buffered) {
+ apr_status_t rv = apr_file_flush_locked(thefile);
+ if (rv != APR_SUCCESS)
+ return rv;
+ }
+
+ if (fstat(thefile->filedes, &info) == 0) {
+ finfo->pool = thefile->pool;
+ finfo->fname = thefile->fname;
+ fill_out_finfo(finfo, &info, wanted);
+ return (wanted & ~finfo->valid) ? APR_INCOMPLETE : APR_SUCCESS;
+ }
+ else {
+ return errno;
+ }
+}
+
APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo,
apr_int32_t wanted,
apr_file_t *thefile)