commit 3e5b0ea5fd169e9aa5468feacb2cd7a7f0764f52
parent a1132c81a1f5322f6f7e6ef06b5c0b212dd29ab7
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Tue, 20 Mar 2018 11:25:16 +0100
files: prevent an infinite loop when reading from standard input fails
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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;