Ticket #2742: 030-bash_inputrc___mc-4.8.8.patch

File 030-bash_inputrc___mc-4.8.8.patch, 1.1 KB (added by er13, 11 years ago)
  • src/subshell.c

     
    267267        putenv (g_strdup (sid_str)); 
    268268    } 
    269269 
     270    char *putenv_str = NULL; 
    270271    switch (subshell_type) 
    271272    { 
    272273    case BASH: 
     274        /* Do we have a custom init file ~/.local/share/mc/bashrc? */ 
    273275        init_file = mc_config_get_full_path ("bashrc"); 
    274276 
     277        /* Otherwise use ~/.bashrc */ 
    275278        if (access (init_file, R_OK) == -1) 
    276279        { 
    277280            g_free (init_file); 
     
    286289            char *input_file = mc_config_get_full_path ("inputrc"); 
    287290            if (access (input_file, R_OK) == 0) 
    288291            { 
    289                 char *putenv_str = g_strconcat ("INPUTRC=", input_file, NULL); 
     292                putenv_str = g_strconcat ("INPUTRC=", input_file, NULL); 
    290293                putenv (putenv_str); 
    291                 g_free (putenv_str); 
     294                /* Do not use "g_free (putenv_str)" here, otherwise INPUTRC will be undefined! */ 
    292295            } 
    293296            g_free (input_file); 
    294297        } 
     
    351354 
    352355    /* If we get this far, everything failed miserably */ 
    353356    g_free (init_file); 
     357    g_free (putenv_str); 
    354358    my_exit (FORK_FAILURE); 
    355359} 
    356360