From d902a66b99dde428d64cca6df8d8386959b3dc95 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Fri, 14 Sep 2012 15:22:15 +0000 Subject: [PATCH] sh: Reduce code duplication: use setinputfile instead of open/setinputfd combination. MFC after: 2 weeks --- bin/sh/main.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/bin/sh/main.c b/bin/sh/main.c index 5eb12e07dacb..b93f04ee0581 100644 --- a/bin/sh/main.c +++ b/bin/sh/main.c @@ -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(); }