Bash-4.2 distribution sources and documentation
This commit is contained in:
parent
30d188c293
commit
495aee441b
341 changed files with 108751 additions and 36060 deletions
|
|
@ -1,7 +1,7 @@
|
|||
This file is exec.def, from which is created exec.c.
|
||||
It implements the builtin "exec" in Bash.
|
||||
|
||||
Copyright (C) 1987-2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987-2010 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
|
|
@ -76,6 +76,7 @@ extern int errno;
|
|||
|
||||
extern int subshell_environment;
|
||||
extern REDIRECT *redirection_undo_list;
|
||||
extern char *exec_argv0;
|
||||
|
||||
int no_exit_on_failed_exec;
|
||||
|
||||
|
|
@ -102,7 +103,7 @@ exec_builtin (list)
|
|||
char *argv0, *command, **args, **env, *newname, *com2;
|
||||
|
||||
cleanenv = login = 0;
|
||||
argv0 = (char *)NULL;
|
||||
exec_argv0 = argv0 = (char *)NULL;
|
||||
|
||||
reset_internal_getopt ();
|
||||
while ((opt = internal_getopt (list, "cla:")) != -1)
|
||||
|
|
@ -147,8 +148,20 @@ exec_builtin (list)
|
|||
|
||||
if (command == 0)
|
||||
{
|
||||
sh_notfound (args[0]);
|
||||
exit_value = EX_NOTFOUND; /* As per Posix.2, 3.14.6 */
|
||||
if (file_isdir (args[0]))
|
||||
{
|
||||
#if defined (EISDIR)
|
||||
builtin_error (_("%s: cannot execute: %s"), args[0], strerror (EISDIR));
|
||||
#else
|
||||
builtin_error (_("%s: cannot execute: %s"), args[0], strerror (errno));
|
||||
#endif
|
||||
exit_value = EX_NOEXEC;
|
||||
}
|
||||
else
|
||||
{
|
||||
sh_notfound (args[0]);
|
||||
exit_value = EX_NOTFOUND; /* As per Posix.2, 3.14.6 */
|
||||
}
|
||||
goto failed_exec;
|
||||
}
|
||||
|
||||
|
|
@ -164,6 +177,7 @@ exec_builtin (list)
|
|||
{
|
||||
free (args[0]);
|
||||
args[0] = login ? mkdashname (argv0) : savestring (argv0);
|
||||
exec_argv0 = savestring (args[0]);
|
||||
}
|
||||
else if (login)
|
||||
{
|
||||
|
|
@ -198,7 +212,7 @@ exec_builtin (list)
|
|||
end_job_control ();
|
||||
#endif /* JOB_CONTROL */
|
||||
|
||||
shell_execve (command, args, env);
|
||||
exit_value = shell_execve (command, args, env);
|
||||
|
||||
/* We have to set this to NULL because shell_execve has called realloc()
|
||||
to stuff more items at the front of the array, which may have caused
|
||||
|
|
@ -207,7 +221,9 @@ exec_builtin (list)
|
|||
if (cleanenv == 0)
|
||||
adjust_shell_level (1);
|
||||
|
||||
if (executable_file (command) == 0)
|
||||
if (exit_value == EX_NOTFOUND) /* no duplicate error message */
|
||||
goto failed_exec;
|
||||
else if (executable_file (command) == 0)
|
||||
{
|
||||
builtin_error (_("%s: cannot execute: %s"), command, strerror (errno));
|
||||
exit_value = EX_NOEXEC; /* As per Posix.2, 3.14.6 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue