Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] pppd: Provide error() implementation in pppoe-discovery
@ 2016-10-15 18:25 stefan.nickl at gmail.com
  2016-10-15 20:33 ` Thomas Petazzoni
  0 siblings, 1 reply; 7+ messages in thread
From: stefan.nickl at gmail.com @ 2016-10-15 18:25 UTC (permalink / raw)
  To: buildroot

From: Stefan Nickl <Stefan.Nickl@gmail.com>

The pppoe-discovery program calls error() from the CHECK_ROOM macro
defined in pppoe.h. Since pppoe-discovery is a standalone program not
linked with the rest of pppd, the only way this could build is by
linking to glibc's proprietary error(3) function instead of the function
of the same name (but with different arguments) defined in pppd/utils.c.

So with glibc this builds, but will probably crash when the assertion is
triggered. As the assertion is unlikely to fail, nobody has noticed.

The build however fails with musl libc or uClibc since they don't
provide the doppelganger.

Signed-off-by: Stefan Nickl <Stefan.Nickl@gmail.com>

--
I noticed pppd failing in the autobuild for uClibc due to one of the issues
that also prevent it from building with musl.  This should fix building
for both, as well as a latent bug when built against glibc.

diff --git a/pppd/plugins/rp-pppoe/pppoe-discovery.c b/pppd/plugins/rp-pppoe/pppoe-discovery.c
index 3d3bf4e..55037df 100644
--- a/pppd/plugins/rp-pppoe/pppoe-discovery.c
+++ b/pppd/plugins/rp-pppoe/pppoe-discovery.c
@@ -9,6 +9,7 @@
  *
  */
 
+#include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -55,6 +56,14 @@ void die(int status)
 	exit(status);
 }
 
+void error(char *fmt, ...)
+{
+    va_list pvar;
+    va_start(pvar, fmt);
+    vfprintf(stderr, fmt, pvar);
+    va_end(pvar);
+}
+
 /* Initialize frame types to RFC 2516 values.  Some broken peers apparently
    use different frame types... sigh... */
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-10-23 18:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-15 18:25 [Buildroot] [PATCH] pppd: Provide error() implementation in pppoe-discovery stefan.nickl at gmail.com
2016-10-15 20:33 ` Thomas Petazzoni
2016-10-16 20:57   ` Stefan Nickl
2016-10-16 21:14     ` Arnout Vandecappelle
2016-10-20 21:24       ` Stefan Nickl
2016-10-21 18:30         ` Arnout Vandecappelle
2016-10-23 18:56           ` Stefan Nickl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox