At the Unix level, you use the readlink() function - very carefully since it does not null-terminate the string it returns.
In the APR interface, ... it is not clear that there are APR wrapper functions to cover this.
Hi all,
ok, I'm in the process of writing an apache httpd module, and have been
looking through the docs for apr functions, as I want to use what I have
available to me, rather than include outside system sources.
When I do a stat on a symbolic link, I need to be able to see the links
target path, and I can't seem to figure out how to get that.
For instance, for a link that might look like this:
/links/dude.domain.com -> /home/sites/volume03/site/htdocs
When I do the apr_stat on the /link/dude.domain.com link, it appears I
get all the stat info on the link itself, but how do I read the
destination path from the structure?
Here's an example of how I'm using the code :
apr_finfo_t pathstat;
char *path;
path = "/links/dude.domain.com";
apr_stat(&pathstat,path,APR_FINFO_LINK,r->pool);
Then, I am trying to look at the data fields returned like
pathstat.fname, and pathstat.name, but I'm not getting the path of the
destination, only the original path to the link.
I tried using different parameters like APR_FINFO_NAME, or APR_FINFO_TYPE...
I can't figure out how to get the path to the target...
If it matters, I'm using the latest 2.2.17 httpd, which I believe uses
the 1.4 branch of the apr libraries, and I am on FreeBSD.
any help would be appreciated!
Thanks,
Tim.