[BACK]Return to patch-src_plugin.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / net / gift / patches

File: [cvs.NetBSD.org] / pkgsrc / net / gift / patches / patch-src_plugin.c (download)

Revision 1.1, Tue Dec 26 11:27:39 2017 UTC (2 years, 11 months ago) by he
Branch: MAIN
CVS Tags: pkgsrc-2020Q3-base, pkgsrc-2020Q3, pkgsrc-2020Q2-base, pkgsrc-2020Q2, pkgsrc-2020Q1-base, pkgsrc-2020Q1, pkgsrc-2019Q4-base, pkgsrc-2019Q4, pkgsrc-2019Q3-base, pkgsrc-2019Q3, pkgsrc-2019Q2-base, pkgsrc-2019Q2, pkgsrc-2019Q1-base, pkgsrc-2019Q1, pkgsrc-2018Q4-base, pkgsrc-2018Q4, pkgsrc-2018Q3-base, pkgsrc-2018Q3, pkgsrc-2018Q2-base, pkgsrc-2018Q2, pkgsrc-2018Q1-base, pkgsrc-2018Q1, pkgsrc-2017Q4-base, pkgsrc-2017Q4, HEAD

Add a couple of patches:
 * Quiet type conversion warnings by adding const to one of the logging
   functions
 * Don't confuse the C preprocessor by converting one arg into two.
   Fixes build on NetBSD/8.0 with SSP.
Bump PKGREVISION.

$NetBSD: patch-src_plugin.c,v 1.1 2017/12/26 11:27:39 he Exp $

Don't confuse the C preprocessor by supplying what looks
like a single argument into two arguments.  (Confuses SSP macros.)

--- src/plugin.c.orig	2004-11-12 02:52:16.000000000 +0000
+++ src/plugin.c
@@ -123,16 +123,18 @@ static void *dummy_voidptr_null (/*< voi
  * This is just terrible.  Please make me fix this.
  */
 #define APPENDMSG msg + msgwr, sizeof (msg) - msgwr - 1
+#define MSGPTR msg + msgwr
+#define REMAIN sizeof(msg) - msgwr - 1
 #define LOGMSG(fmt,pfx1,pfx2)                                              \
 	char    msg[4096];                                                     \
 	size_t  msgwr = 0;                                                     \
 	va_list args;                                                          \
 	if (pfx1)                                                              \
-		msgwr += snprintf (APPENDMSG, "%s: ", STRING_NOTNULL(pfx1));       \
+		msgwr += snprintf (MSGPTR, REMAIN, "%s: ", STRING_NOTNULL(pfx1));       \
 	if (pfx2)                                                              \
-		msgwr += snprintf (APPENDMSG, "[%s]: ", STRING_NOTNULL(pfx2));     \
+		msgwr += snprintf (MSGPTR, REMAIN, "[%s]: ", STRING_NOTNULL(pfx2));     \
 	va_start (args, fmt);                                                  \
-	vsnprintf (APPENDMSG, fmt, args);                                      \
+	vsnprintf (MSGPTR, REMAIN, fmt, args);                                 \
 	va_end (args);
 
 static int wrapper_dbg (Protocol *p, char *fmt, ...)