Hi!

This patch prevent mc from forking subshell when it is called as editor
or viewer. Builtin editor use my_system () for sorting, mailing and so on,
so there are no needs for subshell.

As for me it is a problem with my_system () and mcedit. 
User can prepare a sort option or mail address with semicolon 
and execute any command. It seems we need a secure option for mcedit 
and mcview for banks, etc, where editor must allow to edit given file
and nothing more.

If noone will comaplain too much and of course there are no any side effects,
I shall commit this patch next Mon.

Andrew.

Index: main.c
===================================================================
RCS file: /cvs/gnome/mc/src/main.c,v
retrieving revision 1.121
diff -u -u -r1.121 main.c
--- main.c      2001/01/27 06:43:43     1.121
+++ main.c      2001/01/29 19:01:18
@@ -1106,9 +1106,7 @@
        if (panel->dir_history->prev || panel->dir_history->next) {
            s = show_hist (panel->dir_history, panel->widget.x, panel->widget.y);
            if (s) {
-               int r;
-               r = _do_panel_cd (panel, s, cd_exact);
-               if (r)
+               if (_do_panel_cd (panel, s, cd_exact))
                    directory_history_add (panel, panel->cwd);
                g_free (s);
            }
@@ -3128,14 +3126,13 @@
 
 #ifdef HAVE_GNOME
     init_colors ();
+    use_subshell = 0;
 #else
     init_curses ();
+    if (edit_one_file || view_one_file)
+       use_subshell = 0;
 #endif
 
-#ifdef HAVE_GNOME
-    use_subshell = 0;
-#endif
-    
 #   ifdef HAVE_SUBSHELL_SUPPORT
        /* Done here to ensure that the subshell doesn't  */
        /* inherit the file descriptors opened below, etc */

Reply via email to