Merge branch 'master' into bindings

This commit is contained in:
Daniel Eklöf 2020-03-09 18:49:44 +01:00
commit fc7b3b2d85
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
7 changed files with 40 additions and 22 deletions

View file

@ -413,6 +413,12 @@ parse_section_csd(const char *key, const char *value, struct config *conf,
conf->csd.color.close_set = true;
conf->csd.color.close = color;
}
else {
LOG_WARN("%s:%u: invalid key: %s", path, lineno, key);
return false;
}
return true;
}
@ -561,12 +567,16 @@ err:
static char *
get_server_socket_path(void)
{
const char *xdg_session_id = getenv("XDG_SESSION_ID");
const char *xdg_runtime = getenv("XDG_RUNTIME_DIR");
if (xdg_runtime == NULL)
return strdup("/tmp/foot.sock");
char *path = malloc(strlen(xdg_runtime) + 1 + strlen("foot.sock") + 1);
sprintf(path, "%s/foot.sock", xdg_runtime);
if (xdg_session_id == NULL)
xdg_session_id = "<no-session>";
char *path = malloc(strlen(xdg_runtime) + 1 + strlen("foot-.sock") + strlen(xdg_session_id) + 1);
sprintf(path, "%s/foot-%s.sock", xdg_runtime, xdg_session_id);
return path;
}