Wed Jun 24 07:02:57 2020 UTC ()
errno is irrelevant here.


(rin)
diff -r1.4 -r1.5 src/tests/kernel/t_pty.c

cvs diff -r1.4 -r1.5 src/tests/kernel/t_pty.c (expand / switch to unified diff)

--- src/tests/kernel/t_pty.c 2020/06/24 06:15:40 1.4
+++ src/tests/kernel/t_pty.c 2020/06/24 07:02:57 1.5
@@ -1,25 +1,25 @@ @@ -1,25 +1,25 @@
1/* $Id: t_pty.c,v 1.4 2020/06/24 06:15:40 rin Exp $ */ 1/* $Id: t_pty.c,v 1.5 2020/06/24 07:02:57 rin Exp $ */
2 2
3/* 3/*
4 * Allocates a pty(4) device, and sends the specified number of packets of the 4 * Allocates a pty(4) device, and sends the specified number of packets of the
5 * specified length though it, while a child reader process reads and reports 5 * specified length though it, while a child reader process reads and reports
6 * results. 6 * results.
7 * 7 *
8 * Written by Matthew Mondor 8 * Written by Matthew Mondor
9 */ 9 */
10 10
11#include <sys/cdefs.h> 11#include <sys/cdefs.h>
12__RCSID("$NetBSD: t_pty.c,v 1.4 2020/06/24 06:15:40 rin Exp $"); 12__RCSID("$NetBSD: t_pty.c,v 1.5 2020/06/24 07:02:57 rin Exp $");
13 13
14#include <errno.h> 14#include <errno.h>
15#include <err.h> 15#include <err.h>
16#include <fcntl.h> 16#include <fcntl.h>
17#include <poll.h> 17#include <poll.h>
18#include <stdio.h> 18#include <stdio.h>
19#ifdef __linux__ 19#ifdef __linux__
20#define _XOPEN_SOURCE 20#define _XOPEN_SOURCE
21#define __USE_XOPEN 21#define __USE_XOPEN
22#endif 22#endif
23#include <stdint.h> 23#include <stdint.h>
24#include <stdlib.h> 24#include <stdlib.h>
25#include <string.h> 25#include <string.h>
@@ -109,27 +109,27 @@ void run(void) @@ -109,27 +109,27 @@ void run(void)
109 109
110static void 110static void
111condition(int fd) 111condition(int fd)
112{ 112{
113 struct termios tios; 113 struct termios tios;
114 114
115 if (qsize) { 115 if (qsize) {
116 int opt = qsize; 116 int opt = qsize;
117 if (ioctl(fd, TIOCSQSIZE, &opt) == -1) 117 if (ioctl(fd, TIOCSQSIZE, &opt) == -1)
118 atf_tc_fail_errno("Couldn't set tty(4) buffer size"); 118 atf_tc_fail_errno("Couldn't set tty(4) buffer size");
119 if (ioctl(fd, TIOCGQSIZE, &opt) == -1) 119 if (ioctl(fd, TIOCGQSIZE, &opt) == -1)
120 atf_tc_fail_errno("Couldn't get tty(4) buffer size"); 120 atf_tc_fail_errno("Couldn't get tty(4) buffer size");
121 if (opt != qsize) 121 if (opt != qsize)
122 atf_tc_fail_errno("Wrong qsize %d != %d\n", qsize, opt); 122 atf_tc_fail("Wrong qsize %d != %d\n", qsize, opt);
123 } 123 }
124 if (tcgetattr(fd, &tios) == -1) 124 if (tcgetattr(fd, &tios) == -1)
125 atf_tc_fail_errno("tcgetattr()"); 125 atf_tc_fail_errno("tcgetattr()");
126 cfmakeraw(&tios); 126 cfmakeraw(&tios);
127 cfsetspeed(&tios, B921600); 127 cfsetspeed(&tios, B921600);
128 if (tcsetattr(fd, TCSANOW, &tios) == -1) 128 if (tcsetattr(fd, TCSANOW, &tios) == -1)
129 atf_tc_fail_errno("tcsetattr()"); 129 atf_tc_fail_errno("tcsetattr()");
130} 130}
131 131
132static int 132static int
133pty_open(void) 133pty_open(void)
134{ 134{
135 int fd; 135 int fd;