summaryrefslogtreecommitdiffstats
path: root/tmux.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2011-10-23 15:08:58 +0000
committerTiago Cunha <tcunha@gmx.com>2011-10-23 15:08:58 +0000
commita8ca1340ad1217a6512ce21586f05102c4000cc9 (patch)
treec18aaadc2f5aaf691313bb87f6c6551d1e599222 /tmux.c
parent7d169a3679b254c657823906fb61505bccc26aa3 (diff)
Sync OpenBSD patchset 968:
Try to resolve relative paths for loadb and saveb (first using client working directory if any then default-path or session wd).
Diffstat (limited to 'tmux.c')
-rw-r--r--tmux.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tmux.c b/tmux.c
index 9852c734..76e808e0 100644
--- a/tmux.c
+++ b/tmux.c
@@ -127,6 +127,22 @@ areshell(const char *shell)
return (0);
}
+const char*
+get_full_path(const char *wd, const char *path)
+{
+ static char newpath[MAXPATHLEN];
+ char oldpath[MAXPATHLEN];
+
+ if (getcwd(oldpath, sizeof oldpath) == NULL)
+ return (NULL);
+ if (chdir(wd) != 0)
+ return (NULL);
+ if (realpath(path, newpath) != 0)
+ return (NULL);
+ chdir(oldpath);
+ return (newpath);
+}
+
void
parseenvironment(void)
{