summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/tmux.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2011-10-23 08:34:01 +0000
committernicm <nicm@openbsd.org>2011-10-23 08:34:01 +0000
commit35a092d62738012b07bf5af85703df23fc920d33 (patch)
tree7f74e8847dd8233a69741636b8eaeb2c89a01433 /usr.bin/tmux/tmux.c
parentFor initial session, use size of command client even if detached. (diff)
downloadwireguard-openbsd-35a092d62738012b07bf5af85703df23fc920d33.tar.xz
wireguard-openbsd-35a092d62738012b07bf5af85703df23fc920d33.zip
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 'usr.bin/tmux/tmux.c')
-rw-r--r--usr.bin/tmux/tmux.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c
index 9b0f197e6ed..ebb3b91a3cd 100644
--- a/usr.bin/tmux/tmux.c
+++ b/usr.bin/tmux/tmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.c,v 1.106 2011/10/23 08:03:27 nicm Exp $ */
+/* $OpenBSD: tmux.c,v 1.107 2011/10/23 08:34:01 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -124,6 +124,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)
{