From 3e5b0ea5fd169e9aa5468feacb2cd7a7f0764f52 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@telfort.nl>
Date: Tue, 20 Mar 2018 11:25:16 +0100
Subject: [PATCH] files: prevent an infinite loop when reading from standard
 input fails

---
 src/nano.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/nano.c b/src/nano.c
index aed58d88..260784ce 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2605,9 +2605,9 @@ int main(int argc, char **argv)
 		/* If the filename is a dash, read from standard input; otherwise,
 		 * open the file; skip positioning the cursor if either failed. */
 		if (strcmp(argv[optind], "-") == 0) {
+			optind++;
 			if (!scoop_stdin())
 				continue;
-			optind++;
 		} else if (!open_buffer(argv[optind++], FALSE))
 			continue;
 
-- 
GitLab