svn commit: r241030 - stable/9/bin/sh

Jilles Tjoelker jilles at FreeBSD.org
Fri Sep 28 13:43:43 UTC 2012


Author: jilles
Date: Fri Sep 28 13:43:42 2012
New Revision: 241030
URL: http://svn.freebsd.org/changeset/base/241030

Log:
  MFC r240505: sh: Reduce code duplication: use setinputfile instead of
  open/setinputfd combination.

Modified:
  stable/9/bin/sh/main.c
Directory Properties:
  stable/9/bin/sh/   (props changed)

Modified: stable/9/bin/sh/main.c
==============================================================================
--- stable/9/bin/sh/main.c	Fri Sep 28 12:29:25 2012	(r241029)
+++ stable/9/bin/sh/main.c	Fri Sep 28 13:43:42 2012	(r241030)
@@ -266,14 +266,7 @@ read_profile(char *name)
 void
 readcmdfile(const char *name)
 {
-	int fd;
-
-	INTOFF;
-	if ((fd = open(name, O_RDONLY)) >= 0)
-		setinputfd(fd, 1);
-	else
-		error("cannot open %s: %s", name, strerror(errno));
-	INTON;
+	setinputfile(name, 1);
 	cmdloop(0);
 	popfile();
 }


More information about the svn-src-stable-9 mailing list