From owner-svn-src-all@FreeBSD.ORG Fri Sep 14 15:22:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81AFC1065686; Fri, 14 Sep 2012 15:22:16 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6CED08FC12; Fri, 14 Sep 2012 15:22:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8EFMGFn050015; Fri, 14 Sep 2012 15:22:16 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8EFMG6E050012; Fri, 14 Sep 2012 15:22:16 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201209141522.q8EFMG6E050012@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 14 Sep 2012 15:22:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240505 - head/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Sep 2012 15:22:16 -0000 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(); }