[PATCH]: exit_subshell(): Cleanup only if required.



Hello,

The patch fixes an issue with exit_subshell() cleaning up
internal variables even when it should not.

To reproduce:

1) Start MC with subshell support and bash as the subshell

2) Press `Ctrl + O'

3) Press `Tab'

4) Press `Ctrl + O'

5) Press `F10' and select `Yes'

6) MC will warn you that the subshell is active - select `No'

7) Press `Ctrl + O'

8) Type something in the subshell or just press `Ctrl + O'

Changelog:

2005-06-07  Pavel Tsekov <ptsekov gmx net>

	* subshell.c (exit_subshell): Do not blindly perform cleanup.

P.S. Please, apply to both HEAD and 4.6.1.
Index: src/subshell.c
===================================================================
RCS file: /cvsroot/mc/mc/src/subshell.c,v
retrieving revision 1.87
diff -u -p -r1.87 subshell.c
--- src/subshell.c	27 May 2005 03:35:15 -0000	1.87
+++ src/subshell.c	7 Jun 2005 08:19:32 -0000
@@ -650,16 +650,18 @@ exit_subshell (void)
 			   _(" The shell is still active. Quit anyway? "),
 			   0, 2, _("&Yes"), _("&No"));
 
-    if (quit && subshell_type == TCSH) {
-	if (unlink (tcsh_fifo) == -1)
-	    fprintf (stderr, "Cannot remove named pipe %s: %s\r\n",
-		     tcsh_fifo, unix_error_string (errno));
-    }
+    if (quit) {
+	if (subshell_type == TCSH) {
+	    if (unlink (tcsh_fifo) == -1)
+		fprintf (stderr, "Cannot remove named pipe %s: %s\r\n",
+			 tcsh_fifo, unix_error_string (errno));
+	}
 
-    g_free (subshell_prompt);
-    g_free (pty_buffer);
-    subshell_prompt = NULL;
-    pty_buffer = NULL;
+	g_free (subshell_prompt);
+	g_free (pty_buffer);
+	subshell_prompt = NULL;
+	pty_buffer = NULL;
+    }
 
     return quit;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]