svn commit: r240505 - head/bin/sh

Jilles Tjoelker jilles at FreeBSD.org
Fri Sep 14 15:22:16 UTC 2012


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();
 }


More information about the svn-src-all mailing list