Merge branch 'obsd-master'

This commit is contained in:
Thomas
2014-01-20 10:48:12 +00:00
19 changed files with 192 additions and 122 deletions

21
tmux.c
View File

@ -205,8 +205,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;
@ -331,11 +332,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;
}
}
}
@ -367,7 +372,11 @@ main(int argc, char **argv)
}
}
free(label);
strlcpy(socket_path, path, sizeof socket_path);
if (strlcpy(socket_path, path, sizeof socket_path) >= sizeof socket_path) {
fprintf(stderr, "socket path too long: %s\n", path);
exit(1);
}
free(path);
#ifdef HAVE_SETPROCTITLE