Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Sep 2012 13:43:43 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r241030 - stable/9/bin/sh
Message-ID:  <201209281343.q8SDhhjr050336@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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();
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209281343.q8SDhhjr050336>