Changes between Version 2 and Version 3 of Ticket #3692, comment 5
- Timestamp:
- 09/28/16 05:44:13 (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #3692, comment 5
v2 v3 12 12 13 13 {{{ 14 #!c 14 15 #include <stdio.h> 15 16 #include <glib.h> … … 77 78 { 78 79 int exit_status; 79 char* argv[4]; 80 81 argv[0] = mc_shell->path; 82 argv[1] = "-c"; 83 argv[2] = command; 84 argv[3] = NULL; 80 char* argv[] = {mc_shell->path, "-c", command, NULL}; 85 81 86 82 return g_spawn_sync (NULL, argv, envp, G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL, … … 169 165 output for dash / BusyBox ash ("/a/") during first run, and if it doesn't match - 170 166 test again to compare to BusyBox pre 1.20 broken printf output ("7a7") */ 171 command1 = g_strdup_printf ("str=$( (printf \"PS1='\"'$(printf \"%%%%b\" \"\\\\0057a\\\\0057\\\\n\" >&3)'\"'\\nexit 0\\n\" | %s -i 1>/dev/null) 3>&1); if [ \"$str\" = \"/a/\" ]; then exit 0; else exit 1; fi", mc_shell->path); 172 command2 = g_strdup_printf ("str=$( (printf \"PS1='\"'$(printf \"%%%%b\" \"\\\\0057a\\\\0057\\\\n\" >&3)'\"'\\nexit 0\\n\" | %s -i 1>/dev/null) 3>&1); if [ \"$str\" = \"7a7\" ]; then exit 0; else exit 1; fi", mc_shell->path); 167 command1 = g_strdup_printf ("str=$( (" 168 "printf \"PS1='\"'$(printf \"%%%%b\" \"\\\\0057a\\\\0057\\\\n\" >&3)'\"'\\n" 169 "exit 0\\n\" | %s -i 1>/dev/null) 3>&1); " 170 "if [ \"$str\" = \"/a/\" ]; then " 171 "exit 0; " 172 "else " 173 "exit 1; " 174 "fi", mc_shell->path); 175 command2 = g_strdup_printf ("str=$( (" 176 "printf \"PS1='\"'$(printf \"%%%%b\" \"\\\\0057a\\\\0057\\\\n\" >&3)'\"'\\n" 177 "exit 0\\n\" | %s -i 1>/dev/null) 3>&1); " 178 "if [ \"$str\" = \"7a7\" ]; then " 179 "exit 0; " 180 "else " 181 "exit 1; " 182 "fi", mc_shell->path); 173 183 174 184 if (mc_shell_command_success (mc_shell, command1, NULL)) … … 202 212 return 0; 203 213 } 204 205 214 }}} 206 215 … … 243 252 244 253 P.S. I should note that on my system `/bin/csh` is actually `bsd-csh`, so it's detected as unsupported correctly. 254 255 P.P.S. And also I forgot to mention that `/opt/bin/ash` and `/opt/bin/hush` are different `busybox` binaries: `/opt/bin/ash` has `ash` as `sh`, and `/opt/bin/hush` -- `hush`