mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-07 02:32:27 +02:00
commit bash-20130125 snapshot
This commit is contained in:
@@ -114,6 +114,11 @@ _evalfile (filename, flags)
|
||||
|
||||
if (fd < 0 || (fstat (fd, &finfo) == -1))
|
||||
{
|
||||
i = errno;
|
||||
if (fd >= 0)
|
||||
close (fd);
|
||||
errno = i;
|
||||
|
||||
file_error_and_exit:
|
||||
if (((flags & FEVAL_ENOENTOK) == 0) || errno != ENOENT)
|
||||
file_error (filename);
|
||||
@@ -133,11 +138,13 @@ file_error_and_exit:
|
||||
if (S_ISDIR (finfo.st_mode))
|
||||
{
|
||||
(*errfunc) (_("%s: is a directory"), filename);
|
||||
close (fd);
|
||||
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE : -1);
|
||||
}
|
||||
else if ((flags & FEVAL_REGFILE) && S_ISREG (finfo.st_mode) == 0)
|
||||
{
|
||||
(*errfunc) (_("%s: not a regular file"), filename);
|
||||
close (fd);
|
||||
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE : -1);
|
||||
}
|
||||
|
||||
@@ -146,6 +153,7 @@ file_error_and_exit:
|
||||
if (file_size != finfo.st_size || file_size + 1 < file_size)
|
||||
{
|
||||
(*errfunc) (_("%s: file is too large"), filename);
|
||||
close (fd);
|
||||
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE : -1);
|
||||
}
|
||||
|
||||
|
||||
+12
-4
@@ -410,12 +410,20 @@ read_builtin (list)
|
||||
sigalrm_seen = 0;
|
||||
/* Tricky. The top of the unwind-protect stack is the free of
|
||||
input_string. We want to run all the rest and use input_string,
|
||||
so we have to remove it from the stack. */
|
||||
so we have to save input_string temporarily, run the unwind-
|
||||
protects, then restore input_string so we can use it later */
|
||||
orig_input_string = 0;
|
||||
|
||||
remove_unwind_protect ();
|
||||
run_unwind_frame ("read_builtin");
|
||||
input_string[i] = '\0'; /* make sure it's terminated */
|
||||
if (i == 0)
|
||||
{
|
||||
t = (char *)xmalloc (1);
|
||||
t[0] = 0;
|
||||
}
|
||||
else
|
||||
t = savestring (input_string);
|
||||
|
||||
run_unwind_frame ("read_builtin");
|
||||
input_string = t;
|
||||
retval = 128+SIGALRM;
|
||||
goto assign_vars;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user