summary refs log tree commit diff
path: root/src/input.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/input.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/input.c b/src/input.c
index 49a2972..7f99d4a 100644
--- a/src/input.c
+++ b/src/input.c
@@ -428,7 +428,6 @@ int
 setinputfile(const char *fname, int flags)
 {
 	int fd;
-	int fd2;
 
 	INTOFF;
 	if ((fd = open(fname, O_RDONLY)) < 0) {
@@ -436,11 +435,8 @@ setinputfile(const char *fname, int flags)
 			goto out;
 		sh_error("Can't open %s", fname);
 	}
-	if (fd < 10) {
-		fd2 = copyfd(fd, 10);
-		close(fd);
-		fd = fd2;
-	}
+	if (fd < 10)
+		fd = savefd(fd);
 	setinputfd(fd, flags & INPUT_PUSH_FILE);
 out:
 	INTON;