apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mladen Turk" <mt...@mappingsoft.com>
Subject [PATCH] apr_stat - fix getting APR_FINFO_NAME on WIN32
Date Fri, 10 Jan 2003 17:53:52 GMT
Hi,

Don't know if someone noticed but the apr_finfo_t.name is filled out
only in rare cases, when one explicitly sets the (APR_FINFO_NAME |
APR_FINFO_LINK) to the wanted param of apr_stat.
For example apr_stat(&info, "some.file", APR_FINFO_NAME, p) never fills
the info.name member.

The patch fixes that by returning APR_INCOMPLETE from the
apr_file_info_get. The current version returns APR_SUCCESS no mater what
the wanted params was. 
Using the patch call to resolve_idnet doesn't returns if the
APR_FINFO_NAME flag was specified).

The other problem is that info.fname is never resolved too. For example
the unix apr_file_info_get always sets the fname from apr_file_t.
This can be easily achieved simply using
    finfo->fname = thefile->fname;
before the function returns. 


Index: filestat.c
===================================================================
RCS file: /home/cvspublic/apr/file_io/win32/filestat.c,v
retrieving revision 1.77
diff -u -r1.77 filestat.c
--- filestat.c	7 Jan 2003 00:52:53 -0000	1.77
+++ filestat.c	10 Jan 2003 17:30:28 -0000
@@ -449,11 +449,12 @@
 
     /* If we still want something more (besides the name) go get it! 
      */
-    if ((wanted &= ~finfo->valid) & ~APR_FINFO_NAME) {
-        return more_finfo(finfo, thefile->filehand, wanted,
MORE_OF_HANDLE);
+    if ((wanted & ~finfo->valid) & ~APR_FINFO_NAME) {
+        return more_finfo(finfo, thefile->filehand, 
+                          wanted & ~finfo->valid, MORE_OF_HANDLE);
     }
 
-    return APR_SUCCESS;
+    return (wanted & ~finfo->valid) ? APR_INCOMPLETE : APR_SUCCESS;
 }
 
 APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname,



MT.


Mime
View raw message