From e0a22c4659bdf3fb160967a68ec8e1614e9e97cb Mon Sep 17 00:00:00 2001 From: mellon Date: Wed, 17 Dec 1997 16:56:30 +0000 Subject: [PATCH] Turn off the O_NONBLOCK flag after CLOCAL is set. --- usr.bin/tip/tip.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/usr.bin/tip/tip.c b/usr.bin/tip/tip.c index 702235012ddd..d3071c827aba 100644 --- a/usr.bin/tip/tip.c +++ b/usr.bin/tip/tip.c @@ -1,4 +1,4 @@ -/* $NetBSD: tip.c,v 1.17 1997/11/23 04:03:04 mrg Exp $ */ +/* $NetBSD: tip.c,v 1.18 1997/12/17 16:56:30 mellon Exp $ */ /* * Copyright (c) 1983, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\ #if 0 static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: tip.c,v 1.17 1997/11/23 04:03:04 mrg Exp $"); +__RCSID("$NetBSD: tip.c,v 1.18 1997/12/17 16:56:30 mellon Exp $"); #endif /* not lint */ /* @@ -81,6 +81,7 @@ main(argc, argv) int i; char *p; char sbuf[12]; + int fcarg; gid = getgid(); egid = getegid(); @@ -199,6 +200,15 @@ notnumber: } if (!HW) ttysetup(i); + + if ((fcarg = fcntl(FD, F_GETFL, 0)) < 0 || + fcntl(FD, F_SETFL, fcarg & ~O_NONBLOCK) < 0) { + printf("tip: can't clear O_NONBLOCK: %s", strerror (errno)); + daemon_uid(); + (void)uu_unlock (uucplock); + exit(1); + } + cucommon: /* * From here down the code is shared with