diff options
Diffstat (limited to 'usr.bin/tmux/tmux.c')
-rw-r--r-- | usr.bin/tmux/tmux.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c index efa5ed3e365..597d2ea0799 100644 --- a/usr.bin/tmux/tmux.c +++ b/usr.bin/tmux/tmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.c,v 1.121 2013/10/05 08:12:39 nicm Exp $ */ +/* $OpenBSD: tmux.c,v 1.122 2013/10/05 10:40:49 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -127,23 +127,25 @@ areshell(const char *shell) const char* get_full_path(const char *wd, const char *path) { - int fd; - static char newpath[MAXPATHLEN]; + int fd; + static char newpath[MAXPATHLEN]; + const char *retval; fd = open(".", O_RDONLY); if (fd == -1) return (NULL); - if (chdir(wd) != 0) - return (NULL); - if (realpath(path, newpath) != 0) - return (NULL); + retval = NULL; + if (chdir(wd) == 0) { + if (realpath(path, newpath) == 0) + retval = newpath; + } if (fchdir(fd) != 0) chdir("/"); close(fd); - return (newpath); + return (retval); } void |