mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
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:
1 parent
6eb2dbfa63
commit
456c1199d3
1 file changed
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user