Ticket #3598: mc-3598-0032-execute.c-cleanup-Wcast-qual-warning.patch

File mc-3598-0032-execute.c-cleanup-Wcast-qual-warning.patch, 1.1 KB (added by and, 8 years ago)
  • src/execute.c

    From ebcb4b292164732e4e9dbc5e6fa97725d0c77ca3 Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Sat, 20 Feb 2016 16:17:00 +0000
    Subject: [PATCH] execute.c: cleanup -Wcast-qual warning
    
    execute.c: In function 'do_execute':
    execute.c:387:34: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
         g_ptr_array_add (args_array, (char *) command);
                                      ^
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/execute.c | 3 ++-
     1 file changed, 2 insertions(+), 1 deletion(-)
    
    diff --git a/src/execute.c b/src/execute.c
    index c12d58c..0c6ad5b 100644
    a b do_execute (const char *shell, const char *command, int flags) 
    384384    GPtrArray *args_array; 
    385385 
    386386    args_array = g_ptr_array_new (); 
    387     g_ptr_array_add (args_array, (char *) command); 
     387    g_ptr_array_add (args_array, g_strdup (command)); 
    388388    g_ptr_array_add (args_array, NULL); 
    389389 
    390390    do_executev (shell, flags, (char *const *) args_array->pdata); 
    391391 
     392    g_ptr_array_foreach (args_array, (GFunc) g_free, NULL); 
    392393    g_ptr_array_free (args_array, TRUE); 
    393394} 
    394395