Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Sep 2012 15:22:16 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r240505 - head/bin/sh
Message-ID:  <201209141522.q8EFMG6E050012@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Fri Sep 14 15:22:15 2012
New Revision: 240505
URL: http://svn.freebsd.org/changeset/base/240505

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

Modified:
  head/bin/sh/main.c

Modified: head/bin/sh/main.c
==============================================================================
--- head/bin/sh/main.c	Fri Sep 14 15:09:59 2012	(r240504)
+++ head/bin/sh/main.c	Fri Sep 14 15:22:15 2012	(r240505)
@@ -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?201209141522.q8EFMG6E050012>