diff options
author | nicm <nicm> | 2014-01-15 11:46:28 +0000 |
---|---|---|
committer | nicm <nicm> | 2014-01-15 11:46:28 +0000 |
commit | 938768ed3de3e38cb96344b8ec7b794b5e828acf (patch) | |
tree | 9b62667abb35249d20b6471d67740835b83629e6 /tmux.c | |
parent | 3368b602a868eb6570c4ee92f45c2e0ee78631cb (diff) | |
download | rtmux-938768ed3de3e38cb96344b8ec7b794b5e828acf.tar.gz rtmux-938768ed3de3e38cb96344b8ec7b794b5e828acf.tar.bz2 rtmux-938768ed3de3e38cb96344b8ec7b794b5e828acf.zip |
Do not attempt to read .tmux.conf if we can't figure out a home
directory, from Tiago Cunha.
Diffstat (limited to 'tmux.c')
-rw-r--r-- | tmux.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -202,8 +202,9 @@ int main(int argc, char **argv) { struct passwd *pw; - char *s, *path, *label, *home, **var, tmp[MAXPATHLEN]; + char *s, *path, *label, **var, tmp[MAXPATHLEN]; char in[256]; + const char *home; long long pid; int opt, flags, quiet, keys, session; @@ -325,11 +326,15 @@ main(int argc, char **argv) pw = getpwuid(getuid()); if (pw != NULL) home = pw->pw_dir; + else + home = NULL; } - xasprintf(&cfg_file, "%s/.tmux.conf", home); - if (access(cfg_file, R_OK) != 0 && errno == ENOENT) { - free(cfg_file); - cfg_file = NULL; + if (home != NULL) { + xasprintf(&cfg_file, "%s/.tmux.conf", home); + if (access(cfg_file, R_OK) != 0 && errno == ENOENT) { + free(cfg_file); + cfg_file = NULL; + } } } |