Skip to content

Commit e20df6e

Browse files
floppymJun-T
authored andcommitted
53992: check for declaration of fpurge() instead of link-ability
musl-libc has fpurge() but does not declare it in stdio.h. zsh does not need fpurge() if musl is in use.
1 parent fb4e838 commit e20df6e

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2025-10-21 Jun-ichi Takimoto <[email protected]>
2+
3+
* Mike Gilbert: 53992: Src/utils.c, configure.ac: check for
4+
declaration of fpurge() instead of its link-ability (as a
5+
workaround of the problem of musl-libc)
6+
17
2025-10-02 Oliver Kiddle <[email protected]>
28

39
* 53985: Completion/Unix/Command/_git: update to 2.51

Src/utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2022,7 +2022,7 @@ redup(int x, int y)
20222022
{
20232023
int ret = y;
20242024

2025-
#ifdef HAVE_FPURGE
2025+
#if HAVE_DECL_FPURGE
20262026
/* Make sure buffers are cleared when changing descriptor for a
20272027
* FILE object. No fflush() here because the only way anything
20282028
* can legitimately be left in the buffer is when an error has

configure.ac

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@ AC_CHECK_FUNCS(strftime strptime mktime timelocal \
12501250
select poll \
12511251
readlink faccessx fchdir ftruncate \
12521252
fstat lstat lchown fchown fchmod \
1253-
fpurge fseeko ftello \
1253+
fseeko ftello \
12541254
mkfifo _mktemp mkstemp \
12551255
waitpid wait3 \
12561256
sigqueue \
@@ -1292,6 +1292,9 @@ AC_CHECK_FUNCS(strftime strptime mktime timelocal \
12921292
setutxent getutxent endutxent getutent)
12931293
AC_FUNC_STRCOLL
12941294

1295+
# fpurge exists on musl, but is undeclared in stdio.h and isn't actually required
1296+
AC_CHECK_DECLS([fpurge])
1297+
12951298
# isinf() and isnan() can exist as either functions or macros.
12961299
AH_TEMPLATE([HAVE_ISINF],
12971300
[Define to 1 if you have the `isinf' macro or function.])

0 commit comments

Comments
 (0)