From e44274243a2f970f939a2491ef351c520cc4d3c7 Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Fri, 30 Nov 2018 11:21:00 -0800 Subject: [PATCH] conmux: Fix conmux client name There are other users than myself of this, so don't hard code the conmux id as "bjorn" but rather base it on $USER. Signed-off-by: Bjorn Andersson --- conmux.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/conmux.c b/conmux.c index edd5ebd..b2e50b2 100644 --- a/conmux.c +++ b/conmux.c @@ -231,11 +231,16 @@ void *conmux_open(struct device *dev) struct conmux *conmux; struct hostent *hent; const char *service = dev->cdb_serial; + const char *user; ssize_t n; char req[256]; int ret; int fd; + user = getenv("USER"); + if (!user) + user = "unknown"; + ret = registry_lookup(service, &lookup); if (ret) exit(1); @@ -262,7 +267,7 @@ void *conmux_open(struct device *dev) if (ret < 0) err(1, "failed to connect to conmux instance"); - ret = snprintf(req, sizeof(req), "CONNECT id=bjorn to=console\n"); + ret = snprintf(req, sizeof(req), "CONNECT id=cdba:%s to=console\n", user); if (ret >= sizeof(req)) errx(1, "unable to fit connect request in buffer");