summaryrefslogtreecommitdiffstats
path: root/session.c
diff options
context:
space:
mode:
authornicm <nicm>2015-10-31 08:13:58 +0000
committernicm <nicm>2015-10-31 08:13:58 +0000
commit01defc9f4965bb174e1d1295754d5a8695683054 (patch)
tree6f8095583d6176dffe130d6ff3b5dbc3f0e3150d /session.c
parent45f3cea263d1f99912cd6b353c91ccb872c26a71 (diff)
Because pledge(2) does not allow us to pass directory file descriptors
around, we can't use file descriptors for the working directory because we will be unable to pass it to a privileged process to tell it where to read or write files or spawn children. So move tmux back to using strings for the current working directory. We try to check it exists with access() when it is set but ultimately fall back to ~ if it fails at time of use (or / if that fails too).
Diffstat (limited to 'session.c')
-rw-r--r--session.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/session.c b/session.c
index 217b5272..cbaadcee 100644
--- a/session.c
+++ b/session.c
@@ -104,8 +104,8 @@ session_find_by_id(u_int id)
/* Create a new session. */
struct session *
session_create(const char *name, int argc, char **argv, const char *path,
- int cwd, struct environ *env, struct termios *tio, int idx, u_int sx,
- u_int sy, char **cause)
+ const char *cwd, struct environ *env, struct termios *tio, int idx,
+ u_int sx, u_int sy, char **cause)
{
struct session *s;
struct winlink *wl;
@@ -114,7 +114,7 @@ session_create(const char *name, int argc, char **argv, const char *path,
s->references = 1;
s->flags = 0;
- s->cwd = dup(cwd);
+ s->cwd = xstrdup(cwd);
s->curw = NULL;
TAILQ_INIT(&s->lastw);
@@ -224,7 +224,7 @@ session_destroy(struct session *s)
winlink_remove(&s->windows, wl);
}
- close(s->cwd);
+ free((void *)s->cwd);
session_unref(s);
}
@@ -315,7 +315,7 @@ session_previous_session(struct session *s)
/* Create a new window on a session. */
struct winlink *
session_new(struct session *s, const char *name, int argc, char **argv,
- const char *path, int cwd, int idx, char **cause)
+ const char *path, const char *cwd, int idx, char **cause)
{
struct window *w;
struct winlink *wl;