<pre style='margin:0'>
Marcus Calhoun-Lopez (MarcusCalhoun-Lopez) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/24673aac9ff9a839144b4f4e19bb03c36fda5814">https://github.com/macports/macports-ports/commit/24673aac9ff9a839144b4f4e19bb03c36fda5814</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 24673aac9ff9a839144b4f4e19bb03c36fda5814
</span>Author: Marcus Calhoun-Lopez <mcalhoun@macports.org>
AuthorDate: Wed Oct 11 06:47:33 2017 -0700
<span style='display:block; white-space:pre;color:#404040;'> avahi: open dbus's machine-id even without O_CLOEXEC
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Fixes https://trac.macports.org/ticket/53894
</span>---
net/avahi/Portfile | 9 +++++++++
net/avahi/files/patch-avahi_daemon.diff | 23 +++++++++++++++++++++++
2 files changed, 32 insertions(+)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/net/avahi/Portfile b/net/avahi/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 868b02d..c2654fc 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/net/avahi/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/net/avahi/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -6,6 +6,7 @@ PortGroup github 1.0
</span> PortGroup gobject_introspection 1.0
github.setup lathiat avahi 0.6.32 v
<span style='display:block; white-space:pre;background:#e0ffe0;'>+revision 1
</span> categories net devel
maintainers nomaintainer
license LGPL-2.1+
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -30,9 +31,17 @@ patchfiles patch-avahi-daemon-Makefile.in.diff \
</span> patch-initscript-darwin-org.freedesktop.avahi-daemon.plist.in.diff \
patch-initscript-darwin-org.freedesktop.avahi-dnsconfd.plist.in.diff
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# ensure MacPorts machine-id from dbus is found
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# see https://trac.macports.org/ticket/53894 for O_CLOEXEC
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+patchfiles-append patch-avahi_daemon.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> post-patch {
# this preprocessor macro causes a lot of things to be undefined inside netinet/in.h system header.
reinplace "s/-D_XOPEN_SOURCE=500//" ${worksrcpath}/configure
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # use correct location of dbus from patch-avahi_daemon.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s|__MACPORTS_PREFIX__|${prefix}|g" ${worksrcpath}/avahi-daemon/main.c
</span> }
depends_build port:pkgconfig \
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/net/avahi/files/patch-avahi_daemon.diff b/net/avahi/files/patch-avahi_daemon.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..a6f81ec
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/net/avahi/files/patch-avahi_daemon.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,23 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- avahi-daemon/main.c.orig 2015-10-09 16:51:25.000000000 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ avahi-daemon/main.c 2017-10-08 14:01:26.000000000 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -587,11 +587,17 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int fd;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ char buf[32];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- fd = open("/etc/machine-id", O_RDONLY|O_CLOEXEC|O_NOCTTY);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- if (fd == -1 && errno == ENOENT)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- fd = open("/var/lib/dbus/machine-id", O_RDONLY|O_CLOEXEC|O_NOCTTY);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#ifdef O_CLOEXEC
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ fd = open("__MACPORTS_PREFIX__/var/lib/dbus/machine-id", O_RDONLY|O_CLOEXEC|O_NOCTTY);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ fd = open("__MACPORTS_PREFIX__/var/lib/dbus/machine-id", O_RDONLY|O_NOCTTY);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (fd == -1)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#ifndef O_CLOEXEC
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* File is on a filesystem so we never get EINTR or partial reads */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (read(fd, buf, sizeof buf) != sizeof buf) {
</span></pre><pre style='margin:0'>
</pre>