From mboxrd@z Thu Jan 1 00:00:00 1970 From: geoff@collyer.net To: 9fans@collyer.net MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Message-Id: <20020124012541.6079219A65@mail.cse.psu.edu> Subject: [9fans] fix to /sys/src/ape/lib/bsd/pty.c Date: Wed, 23 Jan 2002 17:25:35 -0800 Topicbox-Message-UUID: 42de4e5e-eaca-11e9-9e20-41e7f4b1d025 In the course of trying to get rk to build, I had to get the APE _getpty() working again. The new close and remove may be excessively paranoid, but the changes from `3' to `O_RDWR' are essential. : cpu; diff `{yesterday .} pty.c 66c66 < fd = _OPEN(fssrv, 3); --- > fd = _OPEN(fssrv, O_RDWR); 67a68,77 > /* > * remove fssrv here, if it exists, to avoid a race > * between the loop in the default case below and the > * new ptyfs removing fssrv when it starts. > * we otherwise might be unlucky enough to open the old > * (hung channel) fssrv before ptyfs removes it and break > * out of the loop with an open fd to a hung channel? > */ > close(fd); > remove(fssrv); 78c88 < fd = _OPEN(fssrv, 3); --- > fd = _OPEN(fssrv, O_RDWR); 88c98,99 < _MOUNT(fd, "/dev", MAFTER, ""); --- > if (_MOUNT(fd, "/dev", MAFTER, "") < 0) > ; /* buggery */