diff options
author | Shehjar Tikoo <shehjart@zresearch.com> | 2009-05-05 16:03:16 +0530 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-05-05 17:50:28 +0530 |
commit | fc602c0c17064dfbd81d3d85141b55a40c45d8d9 (patch) | |
tree | 85e6d12e2bf084ecc74525a31950b620766c70c4 | |
parent | e749da85ec67dfa62af5702d199b8f1bcc53d1d7 (diff) |
booster: Add realpath API
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
-rw-r--r-- | booster/src/booster.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c index cdd55486d..45310ae55 100644 --- a/booster/src/booster.c +++ b/booster/src/booster.c @@ -166,6 +166,7 @@ static int (*real_mkfifo) (const char *path, mode_t mode); static int (*real_unlink) (const char *path); static int (*real_symlink) (const char *oldpath, const char *newpath); static int (*real_readlink) (const char *path, char *buf, size_t bufsize); +static char * (*real_realpath) (const char *path, char *resolved); #define RESOLVE(sym) do { \ if (!real_##sym) \ @@ -1465,6 +1466,24 @@ readlink (const char *path, char *buf, size_t bufsize) return ret; } +char * +realpath (const char *path, char *resolved_path) +{ + char *res = NULL; + + res = glusterfs_realpath (path, resolved_path); + if (((res == NULL) && (errno != ENODEV)) || (res != NULL)) + return res; + + if (real_realpath == NULL) { + errno = ENOSYS; + res = NULL; + } else + res = real_realpath (path, resolved_path); + + return res; +} + pid_t fork (void) { @@ -1531,6 +1550,7 @@ _init (void) RESOLVE (unlink); RESOLVE (symlink); RESOLVE (readlink); + RESOLVE (realpath); /* This must be called after resolving real functions * above so that the socket based IO calls in libglusterfsclient |