tests/libcurses: simplify code for writing to the .exp file

If a write(2) returns less than 1, it must be an error.
This commit is contained in:
rillig 2021-02-07 18:14:43 +00:00
parent bdb9e6b7f3
commit 58e6134faa
1 changed files with 4 additions and 9 deletions

View File

@ -1,5 +1,5 @@
%{
/* $NetBSD: testlang_parse.y,v 1.28 2021/02/07 17:50:16 rillig Exp $ */
/* $NetBSD: testlang_parse.y,v 1.29 2021/02/07 18:14:43 rillig Exp $ */
/*-
* Copyright 2009 Brett Lymn <blymn@NetBSD.org>
@ -1092,14 +1092,9 @@ compare_streams(char *filename, bool discard)
}
if (create_check_file) {
if ((result = write(check_fd, &data, 1)) < 1) {
if (result != 0) {
err(2,
"Bad write on file %s", check_file);
}
}
else
ref = data;
if ((result = write(check_fd, &data, 1)) < 1)
err(2, "Bad write on file %s", check_file);
ref = data;
}
if (verbose) {