Ticket #2206: Add jump support to target line in some external editors

Added own wrapper for _exit() system call. Useful for testing.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2013-01-05 13:48:50 +03:00
parent b66a1e0592
commit d32fefee76
6 changed files with 25 additions and 8 deletions

View File

@ -149,6 +149,7 @@ int close_error_pipe (int error, const char *text);
/* Process spawning */
int my_system (int flags, const char *shell, const char *command);
void my_exit (int status);
void save_stop_handler (void);
/* Tilde expansion */

View File

@ -2,7 +2,7 @@
Various utilities - Unix variants
Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2007, 2011
2004, 2005, 2007, 2011, 2012, 2013
The Free Software Foundation, Inc.
Written by:
@ -196,6 +196,21 @@ save_stop_handler (void)
sigaction (SIGTSTP, NULL, &startup_handler);
}
/* --------------------------------------------------------------------------------------------- */
/**
* Wrapper for _exit() system call.
* The _exit() function has gcc's attribute 'noreturn', and this is reason why we can't
* mock the call.
*
* @param status exit code
*/
void
my_exit (int status)
{
_exit (status);
}
/* --------------------------------------------------------------------------------------------- */
int
@ -253,7 +268,7 @@ my_system (int flags, const char *shell, const char *command)
}
_exit (127); /* Exec error */
my_exit (127); /* Exec error */
}
else
{

View File

@ -217,7 +217,7 @@ handle_console_linux (console_action_t action)
while (0);
mc_global.tty.console_flag = '\0';
status = write (1, &mc_global.tty.console_flag, 1);
_exit (3);
my_exit (3);
} /* if (cons_saver_pid ...) */
break;

View File

@ -3082,7 +3082,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
parent_call ((void *) end_bg_process, ctx, 0);
vfs_shut ();
_exit (0);
my_exit (EXIT_SUCCESS);
}
#endif /* ENABLE_BACKGROUND */

View File

@ -241,7 +241,7 @@ init_subshell_child (const char *pty_name)
if (tcsetattr (subshell_pty_slave, TCSANOW, &shell_mode))
{
fprintf (stderr, "Cannot set pty terminal modes: %s\r\n", unix_error_string (errno));
_exit (FORK_FAILURE);
my_exit (FORK_FAILURE);
}
/* Set the pty's size (80x25 by default on Linux) according to the */
@ -303,7 +303,7 @@ init_subshell_child (const char *pty_name)
default:
fprintf (stderr, __FILE__ ": unimplemented subshell type %d\r\n", subshell_type);
_exit (FORK_FAILURE);
my_exit (FORK_FAILURE);
}
/* Attach all our standard file descriptors to the pty */
@ -351,7 +351,7 @@ init_subshell_child (const char *pty_name)
/* If we get this far, everything failed miserably */
g_free (init_file);
_exit (FORK_FAILURE);
my_exit (FORK_FAILURE);
}

View File

@ -66,6 +66,7 @@
#include "lib/strescape.h"
#include "lib/unixcompat.h"
#include "lib/fileloc.h"
#include "lib/util.h" /* my_exit() */
#include "lib/mcconfig.h"
#include "src/execute.h" /* pre_exec, post_exec */
@ -340,7 +341,7 @@ fish_pipeopen (struct vfs_s_super *super, const char *path, const char *argv[])
close (fileset2[0]);
close (fileset2[1]);
execvp (path, const_cast (char **, argv));
_exit (3);
my_exit (3);
}
}