From f7e76a9cb719730bfb3da6daeaa4f68001b4eba8 Mon Sep 17 00:00:00 2001 From: deraadt Date: Sun, 24 Oct 2021 21:27:07 +0000 Subject: [PATCH] What kind of Sun idiot called open() with flags of "2". --- usr.bin/rpcgen/rpc_svcout.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/rpcgen/rpc_svcout.c b/usr.bin/rpcgen/rpc_svcout.c index 19d6dbc1923..2473909c9c6 100644 --- a/usr.bin/rpcgen/rpc_svcout.c +++ b/usr.bin/rpcgen/rpc_svcout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc_svcout.c,v 1.28 2019/06/28 13:35:03 deraadt Exp $ */ +/* $OpenBSD: rpc_svcout.c,v 1.29 2021/10/24 21:27:07 deraadt Exp $ */ /* $NetBSD: rpc_svcout.c,v 1.7 1995/06/24 14:59:59 pk Exp $ */ /* @@ -829,14 +829,14 @@ write_rpc_svc_fg(infile, sp) fprintf(fout, "%sfor (i = 0; i < size; i++)\n", sp); fprintf(fout, "%s\t(void) close(i);\n", sp); /* Redirect stderr and stdout to console */ - fprintf(fout, "%si = open(\"/dev/console\", 2);\n", sp); + fprintf(fout, "%si = open(\"/dev/console\", O_RDWR);\n", sp); fprintf(fout, "%s(void) dup2(i, 1);\n", sp); fprintf(fout, "%s(void) dup2(i, 2);\n", sp); /* This removes control of the controlling terminal */ if (tirpcflag) fprintf(fout, "%ssetsid();\n", sp); else { - fprintf(fout, "%si = open(\"/dev/tty\", 2);\n", sp); + fprintf(fout, "%si = open(\"/dev/tty\", O_RDWR);\n", sp); fprintf(fout, "%sif (i != -1) {\n", sp); fprintf(fout, "%s\t(void) ioctl(i, TIOCNOTTY, (char *)NULL);\n", sp); fprintf(fout, "%s\t(void) close(i);\n", sp); -- 2.20.1