The branch, master has been updated
       via  3493b7dac7785a1675a2fc70e37c4461bb18043c (commit)
       via  d51b4f92d7c9899694e9ef8334030ceb512cb2de (commit)
      from  2057812c8f293b0295740f9b31f877629fc43888 (commit)

- Log -----------------------------------------------------------------
commit 3493b7dac7785a1675a2fc70e37c4461bb18043c
Merge: d51b4f9 2057812
Author: Nicholas Marriott <nicholas.marri...@gmail.com>
Commit: Nicholas Marriott <nicholas.marri...@gmail.com>

    Merge branch 'master' of ssh://git.code.sf.net/p/tmux/tmux-code

 layout.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


commit d51b4f92d7c9899694e9ef8334030ceb512cb2de
Author: Nicholas Marriott <nicholas.marri...@gmail.com>
Commit: Nicholas Marriott <nicholas.marri...@gmail.com>

    Use open(".")/fchdir() to save and restore current directory rather than
    getcwd()/chdir().
---
 osdep-openbsd.c |    2 +-
 tmux.c          |   14 ++++++++++----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/osdep-openbsd.c b/osdep-openbsd.c
index 7be38a9..0a4c144 100644
--- a/osdep-openbsd.c
+++ b/osdep-openbsd.c
@@ -135,7 +135,7 @@ error:
        return (NULL);
 }
 
-char*
+char *
 osdep_get_cwd(int fd)
 {
        int             name[] = { CTL_KERN, KERN_PROC_CWD, 0 };
diff --git a/tmux.c b/tmux.c
index 9c81cff..4ff45d5 100644
--- a/tmux.c
+++ b/tmux.c
@@ -127,19 +127,25 @@ areshell(const char *shell)
        return (0);
 }
 
-const char*
+const char *
 get_full_path(const char *wd, const char *path)
 {
+       int             fd;
        static char     newpath[MAXPATHLEN];
-       char            oldpath[MAXPATHLEN];
 
-       if (getcwd(oldpath, sizeof oldpath) == NULL)
+       fd = open(".", O_RDONLY);
+       if (fd == -1)
                return (NULL);
+
        if (chdir(wd) != 0)
                return (NULL);
        if (realpath(path, newpath) != 0)
                return (NULL);
-       chdir(oldpath);
+
+       if (fchdir(fd) != 0)
+               chdir("/");
+       close(fd);
+
        return (newpath);
 }
 


-----------------------------------------------------------------------

Summary of changes:
 osdep-openbsd.c |    2 +-
 tmux.c          |   14 ++++++++++----
 2 files changed, 11 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
tmux

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
tmux-cvs mailing list
tmux-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to