mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-13 07:00:49 +02:00
fix for exec builtin when the command is not found
This commit is contained in:
+15
-7
@@ -1,6 +1,6 @@
|
||||
/* setlinebuf.c - line-buffer a stdio stream. */
|
||||
|
||||
/* Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1997,2022 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -25,31 +25,39 @@
|
||||
#include <xmalloc.h>
|
||||
|
||||
#if defined (USING_BASH_MALLOC)
|
||||
# define LBUF_BUFSIZE 1008
|
||||
# define LBUF_BUFSIZE 2016
|
||||
#else
|
||||
# define LBUF_BUFSIZE BUFSIZ
|
||||
#endif
|
||||
|
||||
static char *stdoutbuf = 0;
|
||||
static char *stderrbuf = 0;
|
||||
|
||||
/* Cause STREAM to buffer lines as opposed to characters or blocks. */
|
||||
int
|
||||
sh_setlinebuf (stream)
|
||||
FILE *stream;
|
||||
{
|
||||
char *local_linebuf;
|
||||
|
||||
#if !defined (HAVE_SETLINEBUF) && !defined (HAVE_SETVBUF)
|
||||
return (0);
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_SETVBUF)
|
||||
char *local_linebuf;
|
||||
|
||||
#if defined (USING_BASH_MALLOC)
|
||||
local_linebuf = (char *)xmalloc (LBUF_BUFSIZE);
|
||||
if (stream == stdout && stdoutbuf == 0)
|
||||
local_linebuf = stdoutbuf = (char *)xmalloc (LBUF_BUFSIZE);
|
||||
else if (stream == stderr && stderrbuf == 0)
|
||||
local_linebuf = stderrbuf = (char *)xmalloc (LBUF_BUFSIZE);
|
||||
else
|
||||
local_linebuf = (char *)NULL; /* let stdio handle it */
|
||||
#else
|
||||
local_linebuf = (char *)NULL;
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_SETVBUF)
|
||||
return (setvbuf (stream, local_linebuf, _IOLBF, LBUF_BUFSIZE));
|
||||
# else /* !HAVE_SETVBUF */
|
||||
#else /* !HAVE_SETVBUF */
|
||||
|
||||
setlinebuf (stream);
|
||||
return (0);
|
||||
|
||||
Reference in New Issue
Block a user