Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Aug 2023 21:06:51 GMT
From:      Jessica Clarke <jrtc27@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e8a46057d1b9 - stable/13 - resizewin: Stop printing bogus NUL to TTY
Message-ID:  <202308012106.371L6pkm013907@gitrepo.freebsd.org>

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

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

commit e8a46057d1b9a2e7e6f16f61b1fe80125788b6ad
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2023-06-14 22:58:36 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2023-08-01 20:42:53 +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
    
    (cherry picked from commit 456c1199d3b3ee477463c6469940c0370de2b2ea)
---
 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?202308012106.371L6pkm013907>