svn commit: r343215 - head/bin/sh

Jilles Tjoelker jilles at FreeBSD.org
Sun Jan 20 14:25:26 UTC 2019


Author: jilles
Date: Sun Jan 20 14:25:25 2019
New Revision: 343215
URL: https://svnweb.freebsd.org/changeset/base/343215

Log:
  sh: Send libedit "ferr" output to fd 2
  
  The libedit "fout" output must be sent to fd 2 since it contains prompts
  that POSIX says must be sent to fd 2. However, the libedit "ferr" output
  receives error messages such as from "bind" that make no sense to send to fd
  1.

Modified:
  head/bin/sh/histedit.c

Modified: head/bin/sh/histedit.c
==============================================================================
--- head/bin/sh/histedit.c	Sun Jan 20 14:02:54 2019	(r343214)
+++ head/bin/sh/histedit.c	Sun Jan 20 14:25:25 2019	(r343215)
@@ -67,7 +67,7 @@ __FBSDID("$FreeBSD$");
 History *hist;	/* history cookie */
 EditLine *el;	/* editline cookie */
 int displayhist;
-static FILE *el_in, *el_out, *el_err;
+static FILE *el_in, *el_out;
 
 static char *fc_replace(const char *, char *, char *);
 static int not_fcnumber(const char *);
@@ -106,18 +106,16 @@ histedit(void)
 			INTOFF;
 			if (el_in == NULL)
 				el_in = fdopen(0, "r");
-			if (el_err == NULL)
-				el_err = fdopen(1, "w");
 			if (el_out == NULL)
 				el_out = fdopen(2, "w");
-			if (el_in == NULL || el_err == NULL || el_out == NULL)
+			if (el_in == NULL || el_out == NULL)
 				goto bad;
 			term = lookupvar("TERM");
 			if (term)
 				setenv("TERM", term, 1);
 			else
 				unsetenv("TERM");
-			el = el_init(arg0, el_in, el_out, el_err);
+			el = el_init(arg0, el_in, el_out, el_out);
 			if (el != NULL) {
 				if (hist)
 					el_set(el, EL_HIST, history, hist);


More information about the svn-src-all mailing list