ports/net/openmdns/files/patch-compat
Jan Beich 9b05e9c5be net/openmdns: unbreak on DragonFly
packet.c: In function 'pkt_process':
packet.c:405:3: warning: implicit declaration of function 'LIST_FOREACH_SAFE'; did you mean 'RB_FOREACH_SAFE'? [-Wimplicit-function-declaration]
   LIST_FOREACH_SAFE(rr, &pkt->arlist, pentry, rraux) {
   ^~~~~~~~~~~~~~~~~
   RB_FOREACH_SAFE
packet.c:405:39: error: 'pentry' undeclared (first use in this function); did you mean 'rtentry'?
   LIST_FOREACH_SAFE(rr, &pkt->arlist, pentry, rraux) {
                                       ^~~~~~
                                       rtentry
packet.c:405:39: note: each undeclared identifier is reported only once for each function it appears in
packet.c:405:53: error: expected ';' before '{' token
   LIST_FOREACH_SAFE(rr, &pkt->arlist, pentry, rraux) {
                                                     ^~
                                                     ;

Reported by:	DPorts (via muscles)
2018-11-30 01:16:43 +00:00

90 lines
2.2 KiB
Text

--- mdnsctl/mdnsctl.c.orig 2017-02-18 03:02:15 UTC
+++ mdnsctl/mdnsctl.c
@@ -67,8 +67,10 @@ main(int argc, char *argv[])
struct mdns mdns;
struct mdns_service ms;
+#ifdef __OpenBSD__
if (pledge("stdio unix", NULL) == -1)
err(1, NULL);
+#endif
/* parse options */
if ((res = parse(argc - 1, argv + 1)) == NULL)
@@ -77,8 +79,10 @@ main(int argc, char *argv[])
if ((sockfd = mdns_open(&mdns)) == -1)
err(1, "mdns_open");
+#ifdef __OpenBSD__
if (pledge("stdio", NULL) == -1)
err(1, NULL);
+#endif
mdns_set_lookup_A_hook(&mdns, my_lookup_A_hook);
mdns_set_lookup_PTR_hook(&mdns, my_lookup_PTR_hook);
--- mdnsd/mdns.h.orig 2017-02-18 03:02:15 UTC
+++ mdnsd/mdns.h
@@ -31,6 +31,41 @@
#include <event.h>
#include <string.h>
+#ifndef T_NSEC
+#define T_NSEC 47 /* from OpenBSD */
+#endif
+
+#ifndef IFT_CARP
+#define IFT_CARP 0xf8 /* from DragonFly and NetBSD */
+#endif
+
+#ifndef LINK_STATE_IS_UP /* from DragonFly and OpenBSD */
+#define LINK_STATE_IS_UP(_s) ((_s) >= LINK_STATE_UP)
+#endif
+
+#ifndef LIST_FOREACH_SAFE /* DragonFly */
+#define LIST_FOREACH_SAFE LIST_FOREACH_MUTABLE
+#endif
+
+/* Copied from <sys/time.h> on OpenBSD */
+#ifndef timespeccmp
+#define timespeccmp(tsp, usp, cmp) \
+ (((tsp)->tv_sec == (usp)->tv_sec) ? \
+ ((tsp)->tv_nsec cmp (usp)->tv_nsec) : \
+ ((tsp)->tv_sec cmp (usp)->tv_sec))
+#endif
+#ifndef timespecsub
+#define timespecsub(tsp, usp, vsp) \
+ do { \
+ (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \
+ (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \
+ if ((vsp)->tv_nsec < 0) { \
+ (vsp)->tv_sec--; \
+ (vsp)->tv_nsec += 1000000000L; \
+ } \
+ } while (0)
+#endif
+
#define MAXCHARSTR MAXHOSTNAMELEN
#define MAXLABELLEN 64
#define MAXPROTOLEN 4
--- mdnsd/mdnsd.c.orig 2017-02-18 03:02:15 UTC
+++ mdnsd/mdnsd.c
@@ -46,7 +46,9 @@ void fetchmyname(char [MAXHOSTNAMELEN])
void fetchhinfo(struct hinfo *);
struct mdnsd_conf *conf = NULL;
+#ifdef __OpenBSD__
extern char *malloc_options;
+#endif
__dead void
usage(void)
@@ -230,7 +232,9 @@ main(int argc, char *argv[])
switch (ch) {
case 'd':
debug = 1;
+#ifdef __OpenBSD__
malloc_options = "AFGJPX";
+#endif
break;
case 'v':
display_version();