Menu

#1 Interpreter won't initialise for NetBSD daemons

v1.0 (example)
closed
None
5
2014-09-24
2012-12-28
Darren Bane
No

I was trying to write a gopher mole, which is essentially a UNIX daemon, on NetBSD. The interpreter wouldn't initialise because tcgetattr returned an error other than ENOTTY.

The following patch fixes this:

--- keyboard.c.orig 2012-12-28 22:12:15.000000000 +0000
+++ keyboard.c 2012-12-17 00:05:29.000000000 +0000
@@ -1531,7 +1531,7 @@
keyboard = fileno(stdin);
errcode = tcgetattr(keyboard, &tty);
if (errcode < 0) { /* Could not obtain keyboard parameters */
- if (errno != ENOTTY) return FALSE; /* tcgetattr() returned an error we cannot handle */
+ if (errno != ENOTTY && errno != EOPNOTSUPP) return FALSE; /* tcgetattr() returned an error we cannot handle */
/*
** The error returned by tcgetattr() was ENOTTY (not a typewriter).
** This says that stdin is not associated with a keyboard. The

Discussion

  • Anonymous

    Anonymous - 2013-06-22
    • assigned_to: Colin Tuckley
    • Group: --> v1.0 (example)
     
  • Anonymous

    Anonymous - 2013-06-22

    Darren,

    I can't accept your patch as it stands.

    The EOPNOTSUPP errorcode means "Operation not supported on transport endpoint", this doesn't much sound like a tty related error.

    Please investigate further, if this is some quirky behaviour of NetBSD then please wrap the change in an #ifdef NetBSD so that the behaviour on other systems remains the same.

    Colin

     
  • Anonymous

    Anonymous - 2014-09-24
    • status: open --> closed
     
  • Anonymous

    Anonymous - 2014-09-24

    No response from submitter for more info - so closing.

     

Log in to post a comment.

MongoDB Logo MongoDB