From 6edeb62e3980f1a3769ed74cb81567744b5b6e92 Mon Sep 17 00:00:00 2001 From: Thomas Bushnell Date: Mon, 4 Oct 1999 14:39:04 +0000 Subject: 1999-10-04 Thomas Bushnell, BSG * term.h, devio.c, users.c: Revert previous change. Do it this way instead: * users.c (report_carrier_error): New function. (carrier_error): New static global variable. (open_hook): Deal with errors from carrier open. * devio.c (device_open_reply): Move the !RETURNCODE case out of the "initial open" case and use report_carrier_error. * term.h (report_carrier_error): Declare new function. --- term/devio.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) (limited to 'term/devio.c') diff --git a/term/devio.c b/term/devio.c index ce12b085..2306fa3b 100644 --- a/term/devio.c +++ b/term/devio.c @@ -500,32 +500,23 @@ device_open_reply (mach_port_t replyport, assert (open_pending != NOTPENDING); - if (open_pending == INITIAL) + if (returncode != 0) { - /* Special handling for the first open */ - - if (returncode != 0) - { - /* Note that DEVICE is total garbage (not a real port name at all!) - in this case. */ - - if (returncode == D_NO_SUCH_DEVICE) - /* Record that the device does not exist. */ - termflags |= NO_DEVICE; + report_carrier_error (returncode); - /* Bogus. */ - report_carrier_on (); - report_carrier_off (); + mach_port_deallocate (mach_task_self (), phys_reply); + phys_reply = MACH_PORT_NULL; + ports_port_deref (phys_reply_pi); + phys_reply_pi = 0; - mach_port_deallocate (mach_task_self (), phys_reply); - phys_reply = MACH_PORT_NULL; - ports_port_deref (phys_reply_pi); - phys_reply_pi = 0; + open_pending = NOTPENDING; + mutex_unlock (&global_lock); + return 0; + } - open_pending = NOTPENDING; - mutex_unlock (&global_lock); - return 0; - } + if (open_pending == INITIAL) + { + /* Special handling for the first open */ assert (phys_device == MACH_PORT_NULL); assert (phys_reply_writes == MACH_PORT_NULL); -- cgit v1.2.3