]> granicus.if.org Git - vim/commitdiff
patch 8.2.1833: when reading from stdin dup() is called twice v8.2.1833
authorBram Moolenaar <Bram@vim.org>
Sun, 11 Oct 2020 12:58:46 +0000 (14:58 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 11 Oct 2020 12:58:46 +0000 (14:58 +0200)
Problem:    When reading from stdin dup() is called twice.
Solution:   Remove the dup() in main.c. (Ken Takata, closes #7110)

src/main.c
src/version.c

index c87fdbfb5505210ebe2724f41d192ad986987f4b..53b871977e23848af9c80ff2776150a428c2c3ed 100644 (file)
@@ -2704,21 +2704,16 @@ read_stdin(void)
     no_wait_return = TRUE;
     i = msg_didany;
     set_buflisted(TRUE);
-    (void)open_buffer(TRUE, NULL, 0);  // create memfile and read file
+
+    // Create memfile and read from stdin.
+    // This will also dup stdin from stderr to read commands from.
+    (void)open_buffer(TRUE, NULL, 0);
+
     no_wait_return = FALSE;
     msg_didany = i;
     TIME_MSG("reading stdin");
 
     check_swap_exists_action();
-#if !(defined(AMIGA) || defined(MACOS_X))
-    /*
-     * Close stdin and dup it from stderr.  Required for GPM to work
-     * properly, and for running external commands.
-     * Is there any other system that cannot do this?
-     */
-    close(0);
-    vim_ignored = dup(2);
-#endif
 }
 
 /*
index 6368b5e5b9cd03899c0ed0fad1417f1aeeaa47a7..43613450cd2267dce9326854c6cfeeb16e910599 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1833,
 /**/
     1832,
 /**/