mirror of
https://github.com/tmux/tmux.git
synced 2025-10-17 23:31:48 +00:00
If /dev/fd/X is a symlink and realpath() expands symlinks, /dev/fd/X
ends up pointing to the wrong place before it is passed to the client. The path is only used internally so there is no real need for realpath(), remove it and move the get_path function to file.c where all the callers are.
This commit is contained in:
@@ -2111,19 +2111,3 @@ server_client_get_cwd(struct client *c, struct session *s)
|
||||
return (home);
|
||||
return ("/");
|
||||
}
|
||||
|
||||
/* Resolve an absolute path or relative to client working directory. */
|
||||
char *
|
||||
server_client_get_path(struct client *c, const char *file)
|
||||
{
|
||||
char *path, resolved[PATH_MAX];
|
||||
|
||||
if (*file == '/')
|
||||
path = xstrdup(file);
|
||||
else
|
||||
xasprintf(&path, "%s/%s", server_client_get_cwd(c, NULL), file);
|
||||
if (realpath(path, resolved) == NULL)
|
||||
return (path);
|
||||
free(path);
|
||||
return (xstrdup(resolved));
|
||||
}
|
||||
|
Reference in New Issue
Block a user