From 9fb65e657d71430e796be27c33ff05a59beb1926 Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Tue, 28 Oct 2008 06:41:21 +0100 Subject: [PATCH] corrected flags to allow read-only readline --- xio-readline.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xio-readline.c b/xio-readline.c index b4fbac8..74f3318 100644 --- a/xio-readline.c +++ b/xio-readline.c @@ -31,7 +31,7 @@ static int xioopen_readline(int argc, const char *argv[], struct opt *opts, static const struct xioaddr_endpoint_desc xioendpoint_readline0 = { - XIOADDR_SYS, "readline", 0, XIOBIT_WRONLY|XIOBIT_RDWR, GROUP_FD|GROUP_TERMIOS|GROUP_READLINE, XIOSHUT_CLOSE, XIOCLOSE_NONE, xioopen_readline, 0, 0, 0 HELP(NULL) }; + XIOADDR_SYS, "readline", 0, XIOBIT_RDONLY|XIOBIT_RDWR, GROUP_FD|GROUP_TERMIOS|GROUP_READLINE, XIOSHUT_CLOSE, XIOCLOSE_NONE, xioopen_readline, 0, 0, 0 HELP(NULL) }; const union xioaddr_desc *xioaddrs_readline[] = { (union xioaddr_desc *)&xioendpoint_readline0, @@ -75,9 +75,12 @@ static int xioopen_readline(int argc, const char *argv[], struct opt *opts, Notice(msgbuf); xfd->stream.fd1 = 0; /* stdin */ + if ((rw+1) & 2) { + xfd->stream.fd2 = 1; /* stdout */ + } xfd->stream.howtoclose = XIOCLOSE_READLINE; xfd->stream.dtype = XIODATA_READLINE; - xfd->stream.fdtype = FDTYPE_SINGLE; + xfd->stream.fdtype = FDTYPE_DOUBLE; #if WITH_TERMIOS if (Isatty(xfd->stream.fd1)) {