mirror of
https://github.com/tmux/tmux.git
synced 2025-01-14 20:58:53 +00:00
Do not attempt to read .tmux.conf if we can't figure out a home
directory, from Tiago Cunha.
This commit is contained in:
parent
3368b602a8
commit
938768ed3d
15
tmux.c
15
tmux.c
@ -202,8 +202,9 @@ int
|
|||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
char *s, *path, *label, *home, **var, tmp[MAXPATHLEN];
|
char *s, *path, *label, **var, tmp[MAXPATHLEN];
|
||||||
char in[256];
|
char in[256];
|
||||||
|
const char *home;
|
||||||
long long pid;
|
long long pid;
|
||||||
int opt, flags, quiet, keys, session;
|
int opt, flags, quiet, keys, session;
|
||||||
|
|
||||||
@ -325,11 +326,15 @@ main(int argc, char **argv)
|
|||||||
pw = getpwuid(getuid());
|
pw = getpwuid(getuid());
|
||||||
if (pw != NULL)
|
if (pw != NULL)
|
||||||
home = pw->pw_dir;
|
home = pw->pw_dir;
|
||||||
|
else
|
||||||
|
home = NULL;
|
||||||
}
|
}
|
||||||
xasprintf(&cfg_file, "%s/.tmux.conf", home);
|
if (home != NULL) {
|
||||||
if (access(cfg_file, R_OK) != 0 && errno == ENOENT) {
|
xasprintf(&cfg_file, "%s/.tmux.conf", home);
|
||||||
free(cfg_file);
|
if (access(cfg_file, R_OK) != 0 && errno == ENOENT) {
|
||||||
cfg_file = NULL;
|
free(cfg_file);
|
||||||
|
cfg_file = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user