From 9d7a077a055bc9aa3769c281ba360cf91cd390de Mon Sep 17 00:00:00 2001 From: Lukas Jiriste Date: Fri, 13 Oct 2023 16:03:41 +0200 Subject: [PATCH] Fix bug that makes lines stick together This bug is caused by ignoring newline character that appears exactly on the end of buffer. It is ignored because of a wrong logical operator. --- get_next_line.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/get_next_line.c b/get_next_line.c index 8d431e7..ebfa277 100644 --- a/get_next_line.c +++ b/get_next_line.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/08/28 00:01:15 by ljiriste #+# #+# */ -/* Updated: 2023/09/11 18:39:13 by ljiriste ### ########.fr */ +/* Updated: 2023/10/13 16:01:58 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -79,7 +79,7 @@ static int transfer_string(char **res, char *buffer) i += nl; ft_strncat_alloc(res, buffer, i); ft_memmove(buffer, buffer + i, BUFFER_SIZE + 1 - i); - return (buffer[0] && nl); + return (buffer[0] || nl); } char *get_next_line(int fd) -- 2.30.2