Don't use asprintf (requires _GNU_SOURCE_)
In dpkg 1.22.6, the compiler flag -Werror=implicit-function-declaration was enabled by default, see [1] for details.
It fails the build:
| script.c: In function ‘HpingTcl_AppInit’:
| script.c:1351:29: error: implicit declaration of function ‘asprintf’; did you mean ‘vsprintf’? [-Werror=implicit-function-declaration]
| 1351 | if (asprintf(&rcfile, "%s/.hpingrc", home) < 0)
| | ^~~~~~~~
| | vsprintf
Looking at the code, asprintf is not used anywhere, except in the file script.c.
Turns out it's added by a Debian patch. Apparently, the changes was
added to avoid using the variable PATH_MAX
(not defined for GNU Hurd),
but at the same time the patch defines PATH_MAX
if it's not defined...
So it seems to me that we can revert this chunk of the patch, thus removing the use of asprintf, and reverting to using snprintf.
Closes: #1066662
[1] https://wiki.debian.org/qa.debian.org/FTBFS#A2024-03-13_-Werror.3Dimplicit-function-declaration
Edited by Arnaud Rebillout