$NetBSD: patch-am,v 1.2 2006/10/19 22:57:13 bouyer Exp $

--- console/daemon/io.c.orig	2006-10-04 04:28:00.000000000 +0200
+++ console/daemon/io.c	2006-10-17 00:14:15.000000000 +0200
@@ -147,22 +147,26 @@
 	int master;
 	bool success;
 
-	if ((master = getpt()) == -1 ||
-	    grantpt(master) == -1 || unlockpt(master) == -1) {
-		dolog(LOG_ERR, "Failed to create tty for domain-%d",
-		      dom->domid);
-		master = -1;
-	} else {
+	if ((master = posix_openpt(O_RDWR)) == -1) {
+		dolog(LOG_ERR, "Failed to create tty for domain-%d: %s",
+		    dom->domid, strerror(errno));
+		return -1;
+	}
+	if (grantpt(master) == -1) {
+		dolog(LOG_ERR, "Failed to grant tty for domain-%d: %s",
+		    dom->domid, strerror(errno));
+		goto out;
+	}
+	if (unlockpt(master) == -1) {
+		dolog(LOG_ERR, "Failed to unlock tty for domain-%d: %s",
+		    dom->domid, strerror(errno));
+		goto out;
+	}
+	{
 		const char *slave = ptsname(master);
-		struct termios term;
 		char *data;
 		unsigned int len;
 
-		if (tcgetattr(master, &term) != -1) {
-			cfmakeraw(&term);
-			tcsetattr(master, TCSAFLUSH, &term);
-		}
-
 		success = asprintf(&path, "%s/limit", dom->conspath) != -1;
 		if (!success)
 			goto out;
