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 <bjorn.andersson@linaro.org>
This commit is contained in:
Bjorn Andersson
2018-11-30 11:21:00 -08:00
parent 193c195c2a
commit e44274243a

View File

@@ -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");