Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libcurses/director tests/libcurses: simplify code ...



details:   https://anonhg.NetBSD.org/src/rev/8b4a2bf8abb6
branches:  trunk
changeset: 959311:8b4a2bf8abb6
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Feb 07 18:14:43 2021 +0000

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

If a write(2) returns less than 1, it must be an error.

diffstat:

 tests/lib/libcurses/director/testlang_parse.y |  13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diffs (28 lines):

diff -r c8af7e32d0d1 -r 8b4a2bf8abb6 tests/lib/libcurses/director/testlang_parse.y
--- a/tests/lib/libcurses/director/testlang_parse.y     Sun Feb 07 17:50:16 2021 +0000
+++ b/tests/lib/libcurses/director/testlang_parse.y     Sun Feb 07 18:14:43 2021 +0000
@@ -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@localhost>
@@ -1092,14 +1092,9 @@
                }
 
                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) {



Home | Main Index | Thread Index | Old Index