summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_default.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/modules/vfs_default.c')
-rw-r--r--source3/modules/vfs_default.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 6f5b09a5a9..eb0e0b95a6 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1064,12 +1064,25 @@ static int vfswrap_mknod(vfs_handle_struct *handle, const char *pathname, mode_
return result;
}
-static char *vfswrap_realpath(vfs_handle_struct *handle, const char *path, char *resolved_path)
+static char *vfswrap_realpath(vfs_handle_struct *handle, const char *path)
{
char *result;
START_PROFILE(syscall_realpath);
- result = realpath(path, resolved_path);
+#ifdef REALPATH_TAKES_NULL
+ result = realpath(path, NULL);
+#else
+ result = SMB_MALLOC_ARRAY(char, PATH_MAX+1);
+ if (result) {
+ char *resolved_path = realpath(path, result);
+ if (!resolved_path) {
+ SAFE_FREE(result);
+ } else {
+ /* SMB_ASSERT(result == resovled_path) ? */
+ result = resolved_path;
+ }
+ }
+#endif
END_PROFILE(syscall_realpath);
return result;
}