diff options
author | Tiago Cunha <tcunha@gmx.com> | 2011-10-23 15:08:58 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2011-10-23 15:08:58 +0000 |
commit | a8ca1340ad1217a6512ce21586f05102c4000cc9 (patch) | |
tree | c18aaadc2f5aaf691313bb87f6c6551d1e599222 /tmux.c | |
parent | 7d169a3679b254c657823906fb61505bccc26aa3 (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.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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) { |