From 8492a78330126f178e4cc70eb4d03da39b70be46 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sun, 16 Jul 2023 23:45:24 -0600 Subject: [PATCH] sync results of local scans and network scans ./tests/iio_info -s Available contexts: 0: 169.254.231.18 (cpu_thermal,rpi_volt) [ip:raspberrypi.local] 1: (cpu_thermal, rpi_volt on Raspberry Pi 4 Model B Rev 1.1) [local:] This will remove the extra space between device names on the local context, that is not on the network context. Signed-off-by: Robin Getz --- local.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/local.c b/local.c index 6a8d7b928..b8c4ecbdc 100644 --- a/local.c +++ b/local.c @@ -2177,7 +2177,7 @@ static int build_names(void *d, const char *path) dst = cat_file(buf); if (dst) { len = strnlen(names, sizeof(buf)); - iio_snprintf(&names[len], BUF_SIZE - len - 1, "%s, ", dst); + iio_snprintf(&names[len], BUF_SIZE - len - 1, "%s,", dst); free(dst); } return 0; @@ -2212,7 +2212,7 @@ int local_context_scan(struct iio_scan_result *scan_result) if (machine) { if (names[0]) { ret = strnlen(names, sizeof(names)); - names[ret - 2] = '\0'; + names[ret - 1] = '\0'; iio_snprintf(buf, sizeof(buf), "(%s on %s)", names, machine); } else iio_snprintf(buf, sizeof(buf), "(Local IIO devices on %s)", machine);