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:		3d222369ac ("Add a small tool, resizewin(1), to query terminal for window size")
MFC after:	1 week
This commit is contained in:
Jessica Clarke committed 2023-06-14 23:58:36 +01:00
1 parent 6eb2dbfa63
commit 456c1199d3
1 file changed
+1 -1
+1 -1
View File
@@ -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;
}