From a8ca1340ad1217a6512ce21586f05102c4000cc9 Mon Sep 17 00:00:00 2001 From: Tiago Cunha Date: Sun, 23 Oct 2011 15:08:58 +0000 Subject: 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). --- tmux.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tmux.c') 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) { -- cgit v1.2.3