mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
fix: do not read ahead in STDIN
The Open Group Base Specifications Issue 8 IEEE Std 1003.1-2024 sh — shell, the standard command language interpreter says: > When the shell is using standard input and it invokes a command that also uses > standard input, the shell shall ensure that the standard input file pointer > points directly after the command it has read when the command begins > execution. It shall not read ahead in such a manner that any characters > intended to be read by the invoked command are consumed by the shell (whether > interpreted by the shell or not) or that characters that are not read by the > invoked command are not seen by the shell. We used the default BUFFER_SIZE for get_next_line of 1024, which caused us to read ahead farther than was allowed by the Open Group Base Specification. Setting BUFFER_SIZE=1 ensures that we don't read too far ahead, since get_next_line will always immediatly stop once a newline is found. This is for me the simplest way to solve this issue.
This commit is contained in:
parent
e84b88394a
commit
74f013e5c6
1 changed files with 1 additions and 0 deletions
1
Makefile
1
Makefile
|
|
@ -100,6 +100,7 @@ all: $(NAME)
|
|||
$(NAME): $(minishell_objs) $(LIBFT)
|
||||
$(CC) $(CFLAGS) -o $@ $(minishell_objs) $(LINCLUDE) $(LDLIBS)
|
||||
|
||||
$(LIBFT): CFLAGS+=-DBUFFER_SIZE=1
|
||||
$(LIBFT):
|
||||
+$(MAKE) -C $(LIBFTDIR)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue