From b5d95321d4b07dc381210fb26ac9d7533b8fc97b Mon Sep 17 00:00:00 2001 From: Julian Uy Date: Fri, 6 Dec 2024 09:57:27 -0600 Subject: [PATCH] Add missing definition for getline polyfill (#2425) The fallback for when `getline` is not implemented in libc was not compiling due to the fact that the definition for it was missing, so add the definition. --- Makefile.am | 1 + unzip/CMakeLists.txt | 1 + unzip/bsdunzip.c | 1 + unzip/la_getline.h | 16 ++++++++++++++++ 4 files changed, 19 insertions(+) create mode 100644 unzip/la_getline.h diff --git a/Makefile.am b/Makefile.am index 46a3c0e7f..96f6aeaed 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1499,6 +1499,7 @@ bsdunzip_SOURCES= \ unzip/bsdunzip_platform.h \ unzip/cmdline.c \ unzip/la_getline.c \ + unzip/la_getline.h \ unzip/la_queue.h if INC_WINDOWS_FILES diff --git a/unzip/CMakeLists.txt b/unzip/CMakeLists.txt index e9c346897..d229507a3 100644 --- a/unzip/CMakeLists.txt +++ b/unzip/CMakeLists.txt @@ -14,6 +14,7 @@ IF(ENABLE_UNZIP) bsdunzip_platform.h cmdline.c la_getline.c + la_getline.h la_queue.h ../libarchive_fe/err.c ../libarchive_fe/err.h diff --git a/unzip/bsdunzip.c b/unzip/bsdunzip.c index 5058e8798..18c130e90 100644 --- a/unzip/bsdunzip.c +++ b/unzip/bsdunzip.c @@ -9,6 +9,7 @@ #include "bsdunzip_platform.h" #include "la_queue.h" +#include "la_getline.h" #ifdef HAVE_SYS_STAT_H #include #endif diff --git a/unzip/la_getline.h b/unzip/la_getline.h new file mode 100644 index 000000000..d75887319 --- /dev/null +++ b/unzip/la_getline.h @@ -0,0 +1,16 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2011 The NetBSD Foundation, Inc. + * All rights reserved. + */ + +#ifndef LA_GETLINE_H_INCLUDED +#define LA_GETLINE_H_INCLUDED + +#include +#ifndef HAVE_GETLINE +ssize_t getline(char **buf, size_t *bufsiz, FILE *fp); +#endif + +#endif /* !LA_GETLINE_H_INCLUDED */ -- 2.47.2