Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Jun 2023 23:01:12 GMT
From:      Jessica Clarke <jrtc27@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 456c1199d3b3 - main - resizewin: Stop printing bogus NUL to TTY
Message-ID:  <202306142301.35EN1C2l052359@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jrtc27:

URL: https://cgit.FreeBSD.org/src/commit/?id=456c1199d3b3ee477463c6469940c0370de2b2ea

commit 456c1199d3b3ee477463c6469940c0370de2b2ea
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2023-06-14 22:58:36 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2023-06-14 22:58:36 +0000

    resizewin: Stop printing bogus NUL to TTY
    
    A char array has an implicit NUL terminating it, which sizeof will
    include, so we need to subtract 1 here. Printing a NUL can cause issues
    for things like CI environments that aren't expecting it, especially
    with recent Jenkins being stricter about not putting NUL in XML files.
    
    Fixes:          3d222369acbe ("Add a small tool, resizewin(1), to query terminal for window size")
    MFC after:      1 week
---
 usr.bin/resizewin/resizewin.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.bin/resizewin/resizewin.c b/usr.bin/resizewin/resizewin.c
index b6df862b8a49..e53364cf1254 100644
--- a/usr.bin/resizewin/resizewin.c
+++ b/usr.bin/resizewin/resizewin.c
@@ -101,7 +101,7 @@ main(int argc, char **argv)
 	if (tcsetattr(fd, TCSAFLUSH, &new) == -1)
 		exit(1);
 
-	if (write(fd, query, sizeof(query)) != sizeof(query)) {
+	if (write(fd, query, sizeof(query) - 1) != sizeof(query) - 1) {
 		error = 1;
 		goto out;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202306142301.35EN1C2l052359>