:: [DNG] help with C - error: implicit…
Etusivu
Poista viesti
Vastaa
Lähettäjä: Lorenz
Päiväys:  
Vastaanottaja: Devuan ML
Aihe: [DNG] help with C - error: implicit declaration of function
Hello,
I'm an amateur and self-taught "programmer" and I need help from
someone that knows better than me in C.

Runit currently fails to build from source with gcc-14, with
sig_pause.c:14:3: error: implicit declaration of function ‘sigpause’
see
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1075484

looked at the error, did a quick search about 'sigpause'

https://man7.org/linux/man-pages/man3/sigpause.3.html
https://www.ibm.com/docs/fi/zos/2.4.0?topic=functions-sigpause-unblock-signal-wait-signal

and come up with the following patch

--- a/runit-2.1.2/src/sig_pause.c
+++ b/runit-2.1.2/src/sig_pause.c
@@ -11,6 +11,7 @@
sigemptyset(&ss);
sigsuspend(&ss);
#else
+ int sigpause(int);
sigpause(0);
#endif
}

tested, it builds and seems to work fine, so everything ok.
Actually, no.
I tested the same patch in socklog; socklog is syslog daemon
from the same upstream as runit, has many headers in common
with runit and it fails to build with the same error
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1075523

With my patch, it builds but produced binaries are unresponsive
to SIGTERM, which of course is not ok.

So, is my patch wrong? Is it wrong that the implicit type for a
function is int?
I don't understand, if int is the implicit type returned by the function,
how can my patch, that only makes it explicit, change (break) the behaviour
of socklog like that?

Looking to learn something,
Lorenzo

for reference, to browse the source
(runit)
https://salsa.debian.org/debian/runit/-/tree/master/runit-2.1.2/src?ref_type=heads
(socklog)
https://salsa.debian.org/debian/socklog/-/tree/master/src?ref_type=heads