Hello community,

here is the log from the commit of package pipewire for openSUSE:Factory 
checked in at 2019-11-10 21:55:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/pipewire (Old)
 and      /work/SRC/openSUSE:Factory/.pipewire.new.2990 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "pipewire"

Sun Nov 10 21:55:08 2019 rev:6 rq:746221 version:0.2.7

Changes:
--------
--- /work/SRC/openSUSE:Factory/pipewire/pipewire.changes        2019-05-27 
08:29:51.295270501 +0200
+++ /work/SRC/openSUSE:Factory/.pipewire.new.2990/pipewire.changes      
2019-11-10 21:55:11.721749888 +0100
@@ -1,0 +2,13 @@
+Wed Nov  6 12:29:43 UTC 2019 - Fabian Vogt <[email protected]>
+
+- Update to version 0.2.7:
+  + Add support for alsa-lib 1.1.9 which changed the include path
+  + Improve error checking and reporting in the protocol
+  + deviceprovider: fix probing without starting
+  + add sentinel to some functions
+  + compiler fixes for musl
+  + Revert object tree permission checks that broke things, this is
+    probably not a good idea (and the tree of objects is going to
+    be removed later)
+
+-------------------------------------------------------------------

Old:
----
  pipewire-0.2.6.tar.gz

New:
----
  pipewire-0.2.7.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ pipewire.spec ++++++
--- /var/tmp/diff_new_pack.lUiiRu/_old  2019-11-10 21:55:12.373750704 +0100
+++ /var/tmp/diff_new_pack.lUiiRu/_new  2019-11-10 21:55:12.377750709 +0100
@@ -13,7 +13,7 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via https://bugs.opensuse.org/
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
 
@@ -22,7 +22,7 @@
 %define spa_ver 0.1
 
 Name:           pipewire
-Version:        0.2.6
+Version:        0.2.7
 Release:        0
 Summary:        A Multimedia Framework designed to be an audio and video 
server and more
 License:        LGPL-2.1-or-later

++++++ pipewire-0.2.6.tar.gz -> pipewire-0.2.7.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/NEWS new/pipewire-0.2.7/NEWS
--- old/pipewire-0.2.6/NEWS     2019-05-22 11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/NEWS     2019-09-26 15:58:39.000000000 +0200
@@ -1,4 +1,4 @@
-PipeWire 0.2.6
+PipeWire 0.2.7
 
 This is mostly a bugfix release and is API/ABI compatible with
 previous 0.2 versions.
@@ -7,6 +7,20 @@
 scheduling method that will enable audio support. Some of these
 API changes are backported in this branch.
 
+- Add support for alsa-lib 1.1.9 which changed the include path
+- Improve error checking and reporting in the protocol
+- deviceprovider: fix probing without starting
+- add sentinel to some functions
+- compiler fixes for musl
+- Revert object tree permission checks that broke things, this is
+  probably not a good idea (and the tree of objects is going to
+  be removed later)
+
+
+Older versions:
+
+PipeWire 0.2.6
+
 - Improve error checking for threads
 - Fix some memory and fd leaks
 - Fix compilation with C++ compilers and clang
@@ -26,8 +40,6 @@
 - Fix destroy of client-node memory corruption
 - Various small improvements
 
-Older versions:
-
 PipeWire 0.2.5
 
 - build fixes for systemd
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/meson.build 
new/pipewire-0.2.7/meson.build
--- old/pipewire-0.2.6/meson.build      2019-05-22 11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/meson.build      2019-09-26 15:58:39.000000000 +0200
@@ -1,5 +1,5 @@
 project('pipewire', 'c',
-  version : '0.2.6',
+  version : '0.2.7',
   meson_version : '>= 0.47.0',
   default_options : [ 'warning_level=1',
                       'c_std=gnu99',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/spa/include/spa/pod/builder.h 
new/pipewire-0.2.7/spa/include/spa/pod/builder.h
--- old/pipewire-0.2.6/spa/include/spa/pod/builder.h    2019-05-22 
11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/spa/include/spa/pod/builder.h    2019-09-26 
15:58:39.000000000 +0200
@@ -574,7 +574,8 @@
        return spa_pod_builder_deref(builder, 
builder->frame[builder->state.depth].ref);
 }
 
-static inline void *spa_pod_builder_add(struct spa_pod_builder *builder, const 
char *format, ...)
+static inline SPA_SENTINEL void *
+spa_pod_builder_add(struct spa_pod_builder *builder, const char *format, ...)
 {
        void *res;
        va_list args;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/spa/include/spa/pod/parser.h 
new/pipewire-0.2.7/spa/include/spa/pod/parser.h
--- old/pipewire-0.2.6/spa/include/spa/pod/parser.h     2019-05-22 
11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/spa/include/spa/pod/parser.h     2019-09-26 
15:58:39.000000000 +0200
@@ -295,7 +295,7 @@
        return 0;
 }
 
-static inline int spa_pod_parser_get(struct spa_pod_parser *parser,
+static inline SPA_SENTINEL int spa_pod_parser_get(struct spa_pod_parser 
*parser,
                                     const char *format, ...)
 {
        int res;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/spa/include/spa/utils/defs.h 
new/pipewire-0.2.7/spa/include/spa/utils/defs.h
--- old/pipewire-0.2.6/spa/include/spa/utils/defs.h     2019-05-22 
11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/spa/include/spa/utils/defs.h     2019-09-26 
15:58:39.000000000 +0200
@@ -129,12 +129,14 @@
 #define SPA_PRINTF_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1)))
 #define SPA_ALIGNED(align) __attribute__((aligned(align)))
 #define SPA_DEPRECATED __attribute__ ((deprecated))
-#define SPA_EXPORT __attribute__ ((visibility("default")))
+#define SPA_EXPORT __attribute__((visibility("default")))
+#define SPA_SENTINEL __attribute__((__sentinel__))
 #else
 #define SPA_PRINTF_FUNC(fmt, arg1)
 #define SPA_ALIGNED(align)
 #define SPA_DEPRECATED
 #define SPA_EXPORT
+#define SPA_SENTINEL
 #endif
 
 #define SPA_ROUND_DOWN_N(num,align)    ((num) & ~((align) - 1))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/spa/plugins/alsa/alsa-monitor.c 
new/pipewire-0.2.7/spa/plugins/alsa/alsa-monitor.c
--- old/pipewire-0.2.6/spa/plugins/alsa/alsa-monitor.c  2019-05-22 
11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/spa/plugins/alsa/alsa-monitor.c  2019-09-26 
15:58:39.000000000 +0200
@@ -25,7 +25,7 @@
 #include <poll.h>
 
 #include <libudev.h>
-#include <asoundlib.h>
+#include <alsa/asoundlib.h>
 
 #include <spa/support/log.h>
 #include <spa/support/type-map.h>
@@ -173,22 +173,22 @@
        if (!(str && *str))
                str = udev_device_get_syspath(dev);
        if (str && *str) {
-               spa_pod_builder_add(builder, "s", "device.bus_path", "s", str, 
0);
+               spa_pod_builder_add(builder, "s", "device.bus_path", "s", str, 
NULL);
        }
        if ((str = udev_device_get_syspath(dev)) && *str) {
-               spa_pod_builder_add(builder, "s", "sysfs.path", "s", str, 0);
+               spa_pod_builder_add(builder, "s", "sysfs.path", "s", str, NULL);
        }
        if ((str = udev_device_get_property_value(dev, "ID_ID")) && *str) {
-               spa_pod_builder_add(builder, "s", "udev.id", "s", str, 0);
+               spa_pod_builder_add(builder, "s", "udev.id", "s", str, NULL);
        }
        if ((str = udev_device_get_property_value(dev, "ID_BUS")) && *str) {
-               spa_pod_builder_add(builder, "s", "device.bus", "s", str, 0);
+               spa_pod_builder_add(builder, "s", "device.bus", "s", str, NULL);
        }
        if ((str = udev_device_get_property_value(dev, "SUBSYSTEM")) && *str) {
-               spa_pod_builder_add(builder, "s", "device.subsystem", "s", str, 
0);
+               spa_pod_builder_add(builder, "s", "device.subsystem", "s", str, 
NULL);
        }
        if ((str = udev_device_get_property_value(dev, "ID_VENDOR_ID")) && 
*str) {
-               spa_pod_builder_add(builder, "s", "device.vendor.id", "s", str, 
0);
+               spa_pod_builder_add(builder, "s", "device.vendor.id", "s", str, 
NULL);
        }
        str = udev_device_get_property_value(dev, "ID_VENDOR_FROM_DATABASE");
        if (!(str && *str)) {
@@ -198,18 +198,18 @@
                }
        }
        if (str && *str) {
-               spa_pod_builder_add(builder, "s", "device.vendor.name", "s", 
str, 0);
+               spa_pod_builder_add(builder, "s", "device.vendor.name", "s", 
str, NULL);
        }
        if ((str = udev_device_get_property_value(dev, "ID_MODEL_ID")) && *str) 
{
-               spa_pod_builder_add(builder, "s", "device.product.id", "s", 
str, 0);
+               spa_pod_builder_add(builder, "s", "device.product.id", "s", 
str, NULL);
        }
-       spa_pod_builder_add(builder, "s", "device.product.name", "s", name, 0);
+       spa_pod_builder_add(builder, "s", "device.product.name", "s", name, 
NULL);
 
        if ((str = udev_device_get_property_value(dev, "ID_SERIAL")) && *str) {
-               spa_pod_builder_add(builder, "s", "device.serial", "s", str, 0);
+               spa_pod_builder_add(builder, "s", "device.serial", "s", str, 
NULL);
        }
        if ((str = udev_device_get_property_value(dev, "SOUND_FORM_FACTOR")) && 
*str) {
-               spa_pod_builder_add(builder, "s", "device.form_factor", "s", 
str, 0);
+               spa_pod_builder_add(builder, "s", "device.form_factor", "s", 
str, NULL);
        }
        *item = spa_pod_builder_add(builder, "]>", NULL);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/spa/plugins/alsa/alsa-sink.c 
new/pipewire-0.2.7/spa/plugins/alsa/alsa-sink.c
--- old/pipewire-0.2.6/spa/plugins/alsa/alsa-sink.c     2019-05-22 
11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/spa/plugins/alsa/alsa-sink.c     2019-09-26 
15:58:39.000000000 +0200
@@ -19,7 +19,7 @@
 
 #include <stddef.h>
 
-#include <asoundlib.h>
+#include <alsa/asoundlib.h>
 
 #include <spa/node/node.h>
 #include <spa/param/audio/format.h>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/spa/plugins/alsa/alsa-source.c 
new/pipewire-0.2.7/spa/plugins/alsa/alsa-source.c
--- old/pipewire-0.2.6/spa/plugins/alsa/alsa-source.c   2019-05-22 
11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/spa/plugins/alsa/alsa-source.c   2019-09-26 
15:58:39.000000000 +0200
@@ -19,7 +19,7 @@
 
 #include <stddef.h>
 
-#include <asoundlib.h>
+#include <alsa/asoundlib.h>
 
 #include <spa/node/node.h>
 #include <spa/utils/list.h>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/spa/plugins/alsa/alsa-utils.c 
new/pipewire-0.2.7/spa/plugins/alsa/alsa-utils.c
--- old/pipewire-0.2.6/spa/plugins/alsa/alsa-utils.c    2019-05-22 
11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/spa/plugins/alsa/alsa-utils.c    2019-09-26 
15:58:39.000000000 +0200
@@ -143,7 +143,7 @@
        spa_pod_builder_push_object(&b, state->type.param.idEnumFormat, 
state->type.format);
        spa_pod_builder_add(&b,
                        "I", state->type.media_type.audio,
-                       "I", state->type.media_subtype.raw, 0);
+                       "I", state->type.media_subtype.raw, NULL);
 
        snd_pcm_format_mask_alloca(&fmask);
        snd_pcm_hw_params_get_format_mask(params, fmask);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/spa/plugins/alsa/alsa-utils.h 
new/pipewire-0.2.7/spa/plugins/alsa/alsa-utils.h
--- old/pipewire-0.2.6/spa/plugins/alsa/alsa-utils.h    2019-05-22 
11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/spa/plugins/alsa/alsa-utils.h    2019-09-26 
15:58:39.000000000 +0200
@@ -26,7 +26,7 @@
 
 #include <stddef.h>
 
-#include <asoundlib.h>
+#include <alsa/asoundlib.h>
 
 #include <spa/support/type-map.h>
 #include <spa/support/loop.h>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/spa/plugins/v4l2/v4l2-monitor.c 
new/pipewire-0.2.7/spa/plugins/v4l2/v4l2-monitor.c
--- old/pipewire-0.2.6/spa/plugins/v4l2/v4l2-monitor.c  2019-05-22 
11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/spa/plugins/v4l2/v4l2-monitor.c  2019-09-26 
15:58:39.000000000 +0200
@@ -132,22 +132,22 @@
        if (!(str && *str))
                str = udev_device_get_syspath(item->udevice);
        if (str && *str) {
-               spa_pod_builder_add(builder, "s", "device.bus_path", "s", str, 
0);
+               spa_pod_builder_add(builder, "s", "device.bus_path", "s", str, 
NULL);
        }
        if ((str = udev_device_get_syspath(item->udevice)) && *str) {
-               spa_pod_builder_add(builder, "s", "sysfs.path", "s", str, 0);
+               spa_pod_builder_add(builder, "s", "sysfs.path", "s", str, NULL);
        }
        if ((str = udev_device_get_property_value(item->udevice, "ID_ID")) && 
*str) {
-               spa_pod_builder_add(builder, "s", "udev.id", "s", str, 0);
+               spa_pod_builder_add(builder, "s", "udev.id", "s", str, NULL);
        }
        if ((str = udev_device_get_property_value(item->udevice, "ID_BUS")) && 
*str) {
-               spa_pod_builder_add(builder, "s", "device.bus", "s", str, 0);
+               spa_pod_builder_add(builder, "s", "device.bus", "s", str, NULL);
        }
        if ((str = udev_device_get_property_value(item->udevice, "SUBSYSTEM")) 
&& *str) {
-               spa_pod_builder_add(builder, "s", "device.subsystem", "s", str, 
0);
+               spa_pod_builder_add(builder, "s", "device.subsystem", "s", str, 
NULL);
        }
        if ((str = udev_device_get_property_value(item->udevice, 
"ID_VENDOR_ID")) && *str) {
-               spa_pod_builder_add(builder, "s", "device.vendor.id", "s", str, 
0);
+               spa_pod_builder_add(builder, "s", "device.vendor.id", "s", str, 
NULL);
        }
        str = udev_device_get_property_value(item->udevice, 
"ID_VENDOR_FROM_DATABASE");
        if (!(str && *str)) {
@@ -157,17 +157,17 @@
                }
        }
        if (str && *str) {
-               spa_pod_builder_add(builder, "s", "device.vendor.name", "s", 
str, 0);
+               spa_pod_builder_add(builder, "s", "device.vendor.name", "s", 
str, NULL);
        }
        if ((str = udev_device_get_property_value(item->udevice, 
"ID_MODEL_ID")) && *str) {
-               spa_pod_builder_add(builder, "s", "device.product.id", "s", 
str, 0);
+               spa_pod_builder_add(builder, "s", "device.product.id", "s", 
str, NULL);
        }
-       spa_pod_builder_add(builder, "s", "device.product.name", "s", name, 0);
+       spa_pod_builder_add(builder, "s", "device.product.name", "s", name, 
NULL);
        if ((str = udev_device_get_property_value(item->udevice, "ID_SERIAL")) 
&& *str) {
-               spa_pod_builder_add(builder, "s", "device.serial", "s", str, 0);
+               spa_pod_builder_add(builder, "s", "device.serial", "s", str, 
NULL);
        }
        if ((str = udev_device_get_property_value(item->udevice, 
"ID_V4L_CAPABILITIES")) && *str) {
-               spa_pod_builder_add(builder, "s", "device.capabilities", "s", 
str, 0);
+               spa_pod_builder_add(builder, "s", "device.capabilities", "s", 
str, NULL);
        }
 
        *result = spa_pod_builder_add(builder, "]>", NULL);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/spa/plugins/v4l2/v4l2-source.c 
new/pipewire-0.2.7/spa/plugins/v4l2/v4l2-source.c
--- old/pipewire-0.2.6/spa/plugins/v4l2/v4l2-source.c   2019-05-22 
11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/spa/plugins/v4l2/v4l2-source.c   2019-09-26 
15:58:39.000000000 +0200
@@ -458,22 +458,22 @@
 
        spa_pod_builder_add(builder,
                "I", port->current_format.media_type,
-               "I", port->current_format.media_subtype, 0);
+               "I", port->current_format.media_subtype, NULL);
 
        if (port->current_format.media_subtype == t->media_subtype.raw) {
                spa_pod_builder_add(builder,
                        ":", t->format_video.format,    "I", 
port->current_format.info.raw.format,
                        ":", t->format_video.size,      "R", 
&port->current_format.info.raw.size,
-                       ":", t->format_video.framerate, "F", 
&port->current_format.info.raw.framerate, 0);
+                       ":", t->format_video.framerate, "F", 
&port->current_format.info.raw.framerate, NULL);
        } else if (port->current_format.media_subtype == 
t->media_subtype_video.mjpg ||
                   port->current_format.media_subtype == 
t->media_subtype_video.jpeg) {
                spa_pod_builder_add(builder,
                        ":", t->format_video.size,      "R", 
&port->current_format.info.mjpg.size,
-                       ":", t->format_video.framerate, "F", 
&port->current_format.info.mjpg.framerate, 0);
+                       ":", t->format_video.framerate, "F", 
&port->current_format.info.mjpg.framerate, NULL);
        } else if (port->current_format.media_subtype == 
t->media_subtype_video.h264) {
                spa_pod_builder_add(builder,
                        ":", t->format_video.size,      "R", 
&port->current_format.info.h264.size,
-                       ":", t->format_video.framerate, "F", 
&port->current_format.info.h264.framerate, 0);
+                       ":", t->format_video.framerate, "F", 
&port->current_format.info.h264.framerate, NULL);
        } else
                return -EIO;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/spa/plugins/v4l2/v4l2-utils.c 
new/pipewire-0.2.7/spa/plugins/v4l2/v4l2-utils.c
--- old/pipewire-0.2.6/spa/plugins/v4l2/v4l2-utils.c    2019-05-22 
11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/spa/plugins/v4l2/v4l2-utils.c    2019-09-26 
15:58:39.000000000 +0200
@@ -692,15 +692,15 @@
        spa_pod_builder_push_object(builder, t->param.idEnumFormat, t->format);
        spa_pod_builder_add(builder,
                        "I", media_type,
-                       "I", media_subtype, 0);
+                       "I", media_subtype, NULL);
 
        if (media_subtype == t->media_subtype.raw) {
                spa_pod_builder_add(builder,
-                       ":", t->format_video.format, "I", video_format, 0);
+                       ":", t->format_video.format, "I", video_format, NULL);
        }
        spa_pod_builder_add(builder,
                ":", t->format_video.size, "R", 
&SPA_RECTANGLE(port->frmsize.discrete.width,
-                                                              
port->frmsize.discrete.height), 0);
+                                                              
port->frmsize.discrete.height), NULL);
 
        prop = spa_pod_builder_deref(builder,
                        spa_pod_builder_push_prop(builder, 
t->format_video.framerate,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/spa/tests/test-bluez5.c 
new/pipewire-0.2.7/spa/tests/test-bluez5.c
--- old/pipewire-0.2.6/spa/tests/test-bluez5.c  2019-05-22 11:44:12.000000000 
+0200
+++ new/pipewire-0.2.7/spa/tests/test-bluez5.c  2019-09-26 15:58:39.000000000 
+0200
@@ -18,7 +18,6 @@
  */
 
 #include <math.h>
-#include <error.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -45,6 +44,12 @@
 
 static struct spa_log *logger;
 
+#define spa_error(ret,res,msg)                                 \
+({                                                             \
+       fprintf(stderr, "%s: %s", msg, spa_strerror(res));      \
+       return(ret);                                            \
+})
+
 #define spa_debug(f,...) spa_log_trace(logger, f, __VA_ARGS__)
 
 #include <spa/graph/graph.h>
@@ -212,10 +217,11 @@
        if ((res = get_handle(&data, &handle,
                             "build/spa/plugins/support/libspa-support.so",
                             "mapper")) < 0) {
-               error(-1, res, "can't create mapper");
+               spa_error(-1, res, "can't create mapper");
+       }
+       if ((res = spa_handle_get_interface(handle, 0, &iface)) < 0) {
+               spa_error(-1, res, "can't get mapper interface");
        }
-       if ((res = spa_handle_get_interface(handle, 0, &iface)) < 0)
-               error(-1, res, "can't get mapper interface");
 
        data.map = iface;
        data.support[0].type = SPA_TYPE__TypeMap;
@@ -226,13 +232,13 @@
        if ((res = get_handle(&data, &handle,
                             "build/spa/plugins/support/libspa-support.so",
                             "logger")) < 0) {
-               error(-1, res, "can't create logger");
+               spa_error(-1, res, "can't create logger");
        }
 
        if ((res = spa_handle_get_interface(handle,
                                            spa_type_map_get_id(data.map, 
SPA_TYPE__Log),
                                            &iface)) < 0)
-               error(-1, res, "can't get log interface");
+               spa_error(-1, res, "can't get log interface");
 
        data.log = iface;
        data.support[1].type = SPA_TYPE__Log;
@@ -245,24 +251,24 @@
        if ((res = get_handle(&data, &handle,
                             "build/spa/plugins/support/libspa-support.so",
                             "loop")) < 0) {
-               error(-1, res, "can't create loop");
+               spa_error(-1, res, "can't create loop");
        }
        if ((res = spa_handle_get_interface(handle,
                                            spa_type_map_get_id(data.map, 
SPA_TYPE__Loop),
                                            &iface)) < 0)
-               error(-1, res, "can't get loop interface");
+               spa_error(-1, res, "can't get loop interface");
        data.loop = iface;
 
        if ((res = spa_handle_get_interface(handle,
                                            spa_type_map_get_id(data.map, 
SPA_TYPE__LoopControl),
                                            &iface)) < 0)
-               error(-1, res, "can't get loopcontrol interface");
+               spa_error(-1, res, "can't get loopcontrol interface");
        data.loop_control = iface;
 
        if ((res = spa_handle_get_interface(handle,
                                            spa_type_map_get_id(data.map, 
SPA_TYPE__LoopUtils),
                                            &iface)) < 0)
-               error(-1, res, "can't get looputils interface");
+               spa_error(-1, res, "can't get looputils interface");
        data.loop_utils = iface;
 
        data.support[2].type = SPA_TYPE_LOOP__DataLoop;
@@ -278,13 +284,13 @@
        if ((res = get_handle(&data, &handle,
                             "build/spa/plugins/support/libspa-dbus.so",
                             "dbus")) < 0) {
-               error(-1, res, "can't create dbus");
+               spa_error(-1, res, "can't create dbus");
        }
 
        if ((res = spa_handle_get_interface(handle,
                                            spa_type_map_get_id(data.map, 
SPA_TYPE__DBus),
                                            &iface)) < 0)
-               error(-1, res, "can't get dbus interface");
+               spa_error(-1, res, "can't get dbus interface");
 
        data.dbus = iface;
        data.support[6].type = SPA_TYPE__DBus;
@@ -294,13 +300,13 @@
        if ((res = get_handle(&data, &handle,
                             "build/spa/plugins/bluez5/libspa-bluez5.so",
                             "bluez5-monitor")) < 0) {
-               error(-1, res, "can't create bluez5-monitor");
+               spa_error(-1, res, "can't create bluez5-monitor");
        }
 
        if ((res = spa_handle_get_interface(handle,
                                            spa_type_map_get_id(data.map, 
SPA_TYPE__Monitor),
                                            &iface)) < 0)
-               error(-1, res, "can't get monitor interface");
+               spa_error(-1, res, "can't get monitor interface");
 
        data.monitor = iface;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/spa/tests/test-control.c 
new/pipewire-0.2.7/spa/tests/test-control.c
--- old/pipewire-0.2.6/spa/tests/test-control.c 2019-05-22 11:44:12.000000000 
+0200
+++ new/pipewire-0.2.7/spa/tests/test-control.c 2019-09-26 15:58:39.000000000 
+0200
@@ -18,7 +18,6 @@
  */
 
 #include <math.h>
-#include <error.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -44,6 +43,12 @@
 static SPA_TYPE_MAP_IMPL(default_map, 4096);
 static SPA_LOG_IMPL(default_log);
 
+#define spa_error(ret,res,msg)                                 \
+({                                                             \
+       fprintf(stderr, "%s: %s", msg, spa_strerror(res));      \
+       return(ret);                                            \
+})
+
 #define spa_debug(f,...) spa_log_trace(&default_log.log, f, __VA_ARGS__)
 
 #include <spa/graph/graph.h>
@@ -359,7 +364,7 @@
                if ((res = spa_node_port_enum_params(data->source, 
SPA_DIRECTION_OUTPUT, 0,
                                           data->type.param_io.idPropsIn, &idx, 
NULL, &param, &b)) < 1) {
                        if (res < 0)
-                               error(0, -res, "port_enum_params");
+                               spa_error(0, -res, "port_enum_params");
                        break;
                }
 
@@ -373,7 +378,7 @@
                                     SPA_DIRECTION_OUTPUT, 0,
                                     id,
                                     &data->ctrl_source_freq, 
sizeof(data->ctrl_source_freq))) < 0)
-                               error(0, -res, "set_io freq");
+                               spa_error(0, -res, "set_io freq");
 
                }
                else if (propId == data->type.props_volume) {
@@ -381,7 +386,7 @@
                                     SPA_DIRECTION_OUTPUT, 0,
                                     id,
                                     &data->ctrl_source_volume, 
sizeof(data->ctrl_source_volume))) < 0)
-                               error(0, -res, "set_io volume");
+                               spa_error(0, -res, "set_io volume");
                }
        }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/spa/tests/test-mixer.c 
new/pipewire-0.2.7/spa/tests/test-mixer.c
--- old/pipewire-0.2.6/spa/tests/test-mixer.c   2019-05-22 11:44:12.000000000 
+0200
+++ new/pipewire-0.2.7/spa/tests/test-mixer.c   2019-09-26 15:58:39.000000000 
+0200
@@ -18,7 +18,6 @@
  */
 
 #include <math.h>
-#include <error.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -47,6 +46,12 @@
 static SPA_TYPE_MAP_IMPL(default_map, 4096);
 static SPA_LOG_IMPL(default_log);
 
+#define spa_error(ret,res,msg)                                 \
+({                                                             \
+       fprintf(stderr, "%s: %s", msg, spa_strerror(res));      \
+       return(ret);                                            \
+})
+
 #define spa_debug(...) spa_log_trace(&default_log.log,__VA_ARGS__)
 
 #include <spa/graph/graph.h>
@@ -370,7 +375,7 @@
                ":", data->type.props_min_latency, "i", MIN_LATENCY);
 
        if ((res = spa_node_set_param(data->sink, data->type.param.idProps, 0, 
props)) < 0)
-               error(0, -res, "set_param props");
+               spa_error(0, -res, "set_param props");
 
        if ((res = make_node(data, &data->mix,
                             
"build/spa/plugins/audiomixer/libspa-audiomixer.so",
@@ -457,13 +462,13 @@
                                     SPA_DIRECTION_INPUT, data->mix_ports[0],
                                     data->type.io_inprop_volume,
                                     &data->ctrl_volume[0], 
sizeof(data->ctrl_volume[0]))) < 0)
-                               error(0, -res, "set_io volume 0");
+                               spa_error(0, -res, "set_io volume 0");
 
        if ((res = spa_node_port_set_io(data->mix,
                                     SPA_DIRECTION_INPUT, data->mix_ports[1],
                                     data->type.io_inprop_volume,
                                     &data->ctrl_volume[1], 
sizeof(data->ctrl_volume[1]))) < 0)
-                               error(0, -res, "set_io volume 1");
+                               spa_error(0, -res, "set_io volume 1");
 
 
 #ifdef USE_GRAPH
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/spa/tests/test-props2.c 
new/pipewire-0.2.7/spa/tests/test-props2.c
--- old/pipewire-0.2.6/spa/tests/test-props2.c  2019-05-22 11:44:12.000000000 
+0200
+++ new/pipewire-0.2.7/spa/tests/test-props2.c  2019-09-26 15:58:39.000000000 
+0200
@@ -110,7 +110,7 @@
                        "s", &vs,
                        "R", &vr,
                        "F", &vfr,
-                       "P", &va, 0);
+                       "P", &va, NULL);
 
        printf("%u %lu %f %g %s %ux%u %u/%u\n", vi, vl, vf, vd, vs, vr.width, 
vr.height, vfr.num,
               vfr.denom);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/spa/tools/spa-inspect.c 
new/pipewire-0.2.7/spa/tools/spa-inspect.c
--- old/pipewire-0.2.6/spa/tools/spa-inspect.c  2019-05-22 11:44:12.000000000 
+0200
+++ new/pipewire-0.2.7/spa/tools/spa-inspect.c  2019-09-26 15:58:39.000000000 
+0200
@@ -17,7 +17,6 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#include <error.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -73,7 +72,7 @@
                                                data->type.param.idList, &idx1,
                                                NULL, &param, &b)) <= 0) {
                        if (res != 0)
-                               error(0, -res, "enum_params");
+                               printf("error enum_params: %s", 
spa_strerror(res));
                        break;
                }
 
@@ -88,7 +87,7 @@
                                                        id, &idx2,
                                                        NULL, &param, &b)) <= 
0) {
                                if (res != 0)
-                                       error(0, -res, "enum_params %d", id);
+                                       printf("error enum_params %d: %s", id, 
spa_strerror(res));
                                break;
                        }
                        spa_debug_pod(0, data->map, param);
@@ -115,7 +114,7 @@
                                                     data->type.param.idList, 
&idx1,
                                                     NULL, &param, &b)) <= 0) {
                        if (res != 0)
-                               error(0, -res, "port_enum_params");
+                               printf("error port_enum_params: %s", 
spa_strerror(res));
                        break;
                }
                spa_pod_object_parse(param,
@@ -130,7 +129,7 @@
                                                             id, &idx2,
                                                             NULL, &param, &b)) 
<= 0) {
                                if (res != 0)
-                                       error(0, -res, "port_enum_params");
+                                       printf("error port_enum_params %d: %s", 
id, spa_strerror(res));
                                break;
                        }
 
@@ -200,10 +199,10 @@
        printf("factory interfaces:\n");
        for (index = 0;;) {
                if ((res = spa_handle_factory_enum_interface_info(factory, 
&info, &index)) <= 0) {
-                       if (res == 0)
-                               break;
-                       else
-                               error(0, -res, 
"spa_handle_factory_enum_interface_info");
+                       if (res != 0)
+                               printf("error 
spa_handle_factory_enum_interface_info: %s",
+                                               spa_strerror(res));
+                       break;
                }
                printf(" interface: '%s'\n", info->type);
        }
@@ -221,10 +220,10 @@
                uint32_t interface_id;
 
                if ((res = spa_handle_factory_enum_interface_info(factory, 
&info, &index)) <= 0) {
-                       if (res == 0)
-                               break;
-                       else
-                               error(0, -res, 
"spa_handle_factory_enum_interface_info");
+                       if (res != 0)
+                               printf("error 
spa_handle_factory_enum_interface_info: %s",
+                                               spa_strerror(res));
+                       break;
                }
                printf(" interface: '%s'\n", info->type);
 
@@ -314,7 +313,7 @@
 
                if ((res = enum_func(&factory, &index)) <= 0) {
                        if (res != 0)
-                               error(0, -res, "enum_func");
+                               printf("error enum_func: %s", 
spa_strerror(res));
                        break;
                }
                inspect_factory(&data, factory);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/src/gst/gstpipewiredeviceprovider.c 
new/pipewire-0.2.7/src/gst/gstpipewiredeviceprovider.c
--- old/pipewire-0.2.6/src/gst/gstpipewiredeviceprovider.c      2019-05-22 
11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/src/gst/gstpipewiredeviceprovider.c      2019-09-26 
15:58:39.000000000 +0200
@@ -265,7 +265,7 @@
   nd->dev = new_node (self, nd);
   if (nd->dev) {
     if(self->list_only)
-      *self->devices = g_list_prepend (*self->devices, gst_object_ref_sink 
(nd->dev));
+      self->devices = g_list_prepend (self->devices, gst_object_ref_sink 
(nd->dev));
     else
       gst_device_provider_device_add (GST_DEVICE_PROVIDER (self), nd->dev);
   }
@@ -555,6 +555,8 @@
 
   t = pw_core_get_type(c);
 
+  self->type = pw_core_get_type (c);
+
   if (!(r = pw_remote_new (c, NULL, sizeof(*data))))
     goto failed;
 
@@ -612,7 +614,9 @@
   pw_core_destroy (c);
   pw_loop_destroy (l);
 
-  return *self->devices;
+  self->type = NULL;
+
+  return self->devices;
 
 failed:
   pw_loop_destroy (l);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/src/gst/gstpipewiredeviceprovider.h 
new/pipewire-0.2.7/src/gst/gstpipewiredeviceprovider.h
--- old/pipewire-0.2.6/src/gst/gstpipewiredeviceprovider.h      2019-05-22 
11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/src/gst/gstpipewiredeviceprovider.h      2019-09-26 
15:58:39.000000000 +0200
@@ -98,7 +98,7 @@
 
   gboolean end;
   gboolean list_only;
-  GList **devices;
+  GList *devices;
 };
 
 struct _GstPipeWireDeviceProviderClass {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/src/gst/gstpipewiresink.c 
new/pipewire-0.2.7/src/gst/gstpipewiresink.c
--- old/pipewire-0.2.6/src/gst/gstpipewiresink.c        2019-05-22 
11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/src/gst/gstpipewiresink.c        2019-09-26 
15:58:39.000000000 +0200
@@ -36,6 +36,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <sys/socket.h>
 
 #include "gstpipewireformat.h"
@@ -735,7 +736,7 @@
   if (pwsink->fd == -1)
     pw_remote_connect (pwsink->remote);
   else
-    pw_remote_connect_fd (pwsink->remote, pwsink->fd);
+    pw_remote_connect_fd (pwsink->remote, dup(pwsink->fd));
 
   while (TRUE) {
     enum pw_remote_state state = pw_remote_get_state (pwsink->remote, &error);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/src/gst/gstpipewiresrc.c 
new/pipewire-0.2.7/src/gst/gstpipewiresrc.c
--- old/pipewire-0.2.6/src/gst/gstpipewiresrc.c 2019-05-22 11:44:12.000000000 
+0200
+++ new/pipewire-0.2.7/src/gst/gstpipewiresrc.c 2019-09-26 15:58:39.000000000 
+0200
@@ -1002,7 +1002,7 @@
   if (pwsrc->fd == -1)
     pw_remote_connect (pwsrc->remote);
   else
-    pw_remote_connect_fd (pwsrc->remote, pwsrc->fd);
+    pw_remote_connect_fd (pwsrc->remote, dup(pwsrc->fd));
 
   while (TRUE) {
     enum pw_remote_state state = pw_remote_get_state(pwsrc->remote, &error);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/pipewire-0.2.6/src/modules/module-protocol-native/local-socket.c 
new/pipewire-0.2.7/src/modules/module-protocol-native/local-socket.c
--- old/pipewire-0.2.6/src/modules/module-protocol-native/local-socket.c        
2019-05-22 11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/src/modules/module-protocol-native/local-socket.c        
2019-09-26 15:58:39.000000000 +0200
@@ -58,13 +58,16 @@
 
        if ((runtime_dir = getenv("XDG_RUNTIME_DIR")) == NULL) {
                pw_log_error("connect failed: XDG_RUNTIME_DIR not set in the 
environment");
-               return -EIO;
+               res = -EIO;
+               goto error;
         }
 
        name = get_remote(pw_remote_get_properties(remote));
 
-        if ((fd = socket(PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 
0)) < 0)
-                return -errno;
+        if ((fd = socket(PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 
0)) < 0) {
+               res = -errno;
+               goto error;
+       }
 
         memset(&addr, 0, sizeof(addr));
         addr.sun_family = AF_LOCAL;
@@ -84,13 +87,14 @@
                 goto error_close;
        }
 
-       res = pw_protocol_client_connect_fd(client, fd);
+       res = pw_protocol_client_connect_fd(client, fd, true);
 
        done_callback(data, res);
 
        return res;
 
-      error_close:
-        close(fd);
+error_close:
+       close(fd);
+error:
        return res;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/src/modules/module-protocol-native.c 
new/pipewire-0.2.7/src/modules/module-protocol-native.c
--- old/pipewire-0.2.6/src/modules/module-protocol-native.c     2019-05-22 
11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/src/modules/module-protocol-native.c     2019-09-26 
15:58:39.000000000 +0200
@@ -374,14 +374,14 @@
        return NULL;
 }
 
-static bool init_socket_name(struct server *s, const char *name)
+static int init_socket_name(struct server *s, const char *name)
 {
        int name_size;
        const char *runtime_dir;
 
        if ((runtime_dir = getenv("XDG_RUNTIME_DIR")) == NULL) {
                pw_log_error("XDG_RUNTIME_DIR not set in the environment");
-               return false;
+               return -EIO;
        }
 
        s->addr.sun_family = AF_LOCAL;
@@ -392,29 +392,33 @@
                pw_log_error("socket path \"%s/%s\" plus null terminator 
exceeds 108 bytes",
                             runtime_dir, name);
                *s->addr.sun_path = 0;
-               return false;
+               return -ENAMETOOLONG;
        }
-       return true;
+       return 0;
 }
 
-static bool lock_socket(struct server *s)
+static int lock_socket(struct server *s)
 {
+       int res;
+
        snprintf(s->lock_addr, sizeof(s->lock_addr), "%s%s", s->addr.sun_path, 
LOCK_SUFFIX);
 
        s->fd_lock = open(s->lock_addr, O_CREAT | O_CLOEXEC,
                          (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP));
 
        if (s->fd_lock < 0) {
-               pw_log_error("unable to open lockfile %s check permissions", 
s->lock_addr);
+               res = -errno;
+               pw_log_error("unable to open lockfile '%s': %m", s->lock_addr);
                goto err;
        }
 
        if (flock(s->fd_lock, LOCK_EX | LOCK_NB) < 0) {
-               pw_log_error("unable to lock lockfile %s, maybe another daemon 
is running",
+               res = -errno;
+               pw_log_error("unable to lock lockfile '%s': %m (maybe another 
daemon is running)",
                             s->lock_addr);
                goto err_fd;
        }
-       return true;
+       return 0;
 
       err_fd:
        close(s->fd_lock);
@@ -422,7 +426,7 @@
       err:
        *s->lock_addr = 0;
        *s->addr.sun_path = 0;
-       return false;
+       return res;
 }
 
 static void
@@ -454,10 +458,10 @@
                          c->source, SPA_IO_IN | SPA_IO_ERR | SPA_IO_HUP);
 }
 
-static bool add_socket(struct pw_protocol *protocol, struct server *s)
+static int add_socket(struct pw_protocol *protocol, struct server *s)
 {
        socklen_t size;
-       int fd = -1;
+       int fd = -1, res;
        bool activated = false;
 
 #ifdef HAVE_SYSTEMD_DAEMON
@@ -476,33 +480,55 @@
 #endif
 
        if (fd < 0) {
-               if ((fd = socket(PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC | 
SOCK_NONBLOCK, 0)) < 0)
+               struct stat socket_stat;
+
+               if ((fd = socket(PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC | 
SOCK_NONBLOCK, 0)) < 0) {
+                       res = -errno;
                        goto error;
+               }
+               if (stat(s->addr.sun_path, &socket_stat) < 0) {
+                       if (errno != ENOENT) {
+                               res = -errno;
+                               pw_log_error("server %p: stat %s failed with 
error: %m",
+                                               s, s->addr.sun_path);
+                               goto error_close;
+                       }
+               } else if (socket_stat.st_mode & S_IWUSR || socket_stat.st_mode 
& S_IWGRP) {
+                       pw_log_warn("removing stale socket");
+                       unlink(s->addr.sun_path);
+               }
 
                size = offsetof(struct sockaddr_un, sun_path) + 
strlen(s->addr.sun_path);
                if (bind(fd, (struct sockaddr *) &s->addr, size) < 0) {
+                       res = -errno;
                        pw_log_error("bind() failed with error: %m");
                        goto error_close;
                }
 
                if (listen(fd, 128) < 0) {
+                       res = -errno;
                        pw_log_error("listen() failed with error: %m");
                        goto error_close;
                }
        }
 
+       s->activated = activated;
        s->loop = pw_core_get_main_loop(protocol->core);
+       if (s->loop == NULL) {
+               res = -errno;
+               goto error_close;
+       }
        s->source = pw_loop_add_io(s->loop, fd, SPA_IO_IN, true, socket_data, 
s);
-       s->activated = activated;
-       if (s->source == NULL)
+       if (s->source == NULL) {
+               res = -errno;
                goto error_close;
-
-       return true;
+       }
+       return 0;
 
       error_close:
        close(fd);
       error:
-       return false;
+       return res;
 
 }
 
@@ -515,9 +541,12 @@
                return -EIO;
 
        fd = dup(impl->source->fd);
-
+       if (fd == -1) {
+               fd = -errno;
+               goto out;
+       }
        pw_protocol_client_disconnect(client);
-
+out:
        return fd;
 }
 
@@ -619,34 +648,41 @@
        .need_flush = on_need_flush,
 };
 
-static int impl_connect_fd(struct pw_protocol_client *client, int fd)
+static int impl_connect_fd(struct pw_protocol_client *client, int fd, bool 
do_close)
 {
        struct client *impl = SPA_CONTAINER_OF(client, struct client, this);
        struct pw_remote *remote = client->remote;
+       int res;
 
        impl->disconnecting = false;
 
        impl->connection = pw_protocol_native_connection_new(remote->core, fd);
-       if (impl->connection == NULL)
-                goto error_close;
+       if (impl->connection == NULL) {
+               res = -errno;
+               goto error_cleanup;
+       }
+
+       impl->source = pw_loop_add_io(remote->core->main_loop,
+                                       fd,
+                                       SPA_IO_IN | SPA_IO_HUP | SPA_IO_ERR,
+                                       do_close, on_remote_data, impl);
+       if (impl->source == NULL) {
+               res = -errno;
+               goto error_cleanup;
+       }
 
        pw_protocol_native_connection_add_listener(impl->connection,
                                                   &impl->conn_listener,
                                                   &conn_events,
                                                   impl);
-
-        impl->source = pw_loop_add_io(remote->core->main_loop,
-                                      fd,
-                                      SPA_IO_IN | SPA_IO_HUP | SPA_IO_ERR,
-                                      true, on_remote_data, impl);
-       if (impl->source == NULL)
-               goto error_close;
-
        return 0;
 
-      error_close:
-        close(fd);
-        return -ENOMEM;
+error_cleanup:
+       if (impl->connection) {
+               pw_protocol_native_connection_destroy(impl->connection);
+               impl->connection = NULL;
+       }
+       return res;
 }
 
 static void impl_disconnect(struct pw_protocol_client *client)
@@ -689,6 +725,7 @@
        struct client *impl;
        struct pw_protocol_client *this;
        const char *str = NULL;
+       int res;
 
        if ((impl = calloc(1, sizeof(struct client))) == NULL)
                return NULL;
@@ -715,10 +752,21 @@
        this->destroy = impl_destroy;
 
        impl->flush_event = pw_loop_add_event(remote->core->main_loop, 
do_flush_event, impl);
+       if (impl->flush_event == NULL) {
+               res = -errno;
+               goto error_cleanup;
+       }
 
        spa_list_append(&protocol->client_list, &this->link);
 
        return this;
+
+error_cleanup:
+       if (impl->properties)
+               pw_properties_free(impl->properties);
+       free(impl);
+       errno = -res;
+       return NULL;
 }
 
 static void destroy_server(struct pw_protocol_server *server)
@@ -727,6 +775,7 @@
        struct pw_client *client;
 
        spa_list_remove(&server->link);
+       spa_hook_remove(&s->hook);
 
        spa_list_consume(client, &server->client_list, protocol_link)
                pw_client_destroy(client);
@@ -782,6 +831,7 @@
        struct pw_protocol_server *this;
        struct server *s;
        const char *name;
+       int res;
 
        if ((s = calloc(1, sizeof(struct server))) == NULL)
                return NULL;
@@ -797,23 +847,24 @@
 
        name = get_name(pw_core_get_properties(core));
 
-       if (!init_socket_name(s, name))
-               goto error;
+       pw_loop_add_hook(pw_core_get_main_loop(core), &s->hook, &impl_hooks, s);
 
-       if (!lock_socket(s))
+       if ((res = init_socket_name(s, name)) < 0)
                goto error;
 
-       if (!add_socket(protocol, s))
+       if ((res = lock_socket(s)) < 0)
                goto error;
 
-       pw_loop_add_hook(pw_core_get_main_loop(core), &s->hook, &impl_hooks, s);
+       if ((res = add_socket(protocol, s)) < 0)
+               goto error;
 
        pw_log_info("protocol-native %p: Added server %p %s", protocol, this, 
name);
 
        return this;
 
-      error:
+error:
        destroy_server(this);
+       errno = -res;
        return NULL;
 }
 
@@ -909,13 +960,14 @@
        struct pw_protocol *this;
        const char *val;
        struct protocol_data *d;
+       int res;
 
        if (pw_core_find_protocol(core, PW_TYPE_PROTOCOL__Native) != NULL)
                return 0;
 
        this = pw_protocol_new(core, PW_TYPE_PROTOCOL__Native, sizeof(struct 
protocol_data));
        if (this == NULL)
-               return -ENOMEM;
+               return -errno;
 
        debug_messages = pw_debug_is_category_enabled("connection");
 
@@ -935,13 +987,19 @@
        if (val == NULL)
                val = pw_properties_get(pw_core_get_properties(core), 
PW_CORE_PROP_DAEMON);
        if (val && pw_properties_parse_bool(val)) {
-               if (impl_add_server(this, core, properties) == NULL)
-                       return -errno;
+               if (impl_add_server(this, core, properties) == NULL) {
+                       res = -errno;
+                       goto error_cleanup;
+               }
        }
 
        pw_module_add_listener(module, &d->module_listener, &module_events, d);
 
        return 0;
+
+error_cleanup:
+       pw_protocol_destroy(this);
+       return res;
 }
 
 SPA_EXPORT
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/src/pipewire/global.c 
new/pipewire-0.2.7/src/pipewire/global.c
--- old/pipewire-0.2.6/src/pipewire/global.c    2019-05-22 11:44:12.000000000 
+0200
+++ new/pipewire-0.2.7/src/pipewire/global.c    2019-09-26 15:58:39.000000000 
+0200
@@ -38,15 +38,9 @@
 {
        uint32_t perms = PW_PERM_RWX;
 
-       if (client->permission_func == NULL)
-               return perms;
-
-       perms = client->permission_func(global, client, 
client->permission_data);
-
-       while (global != global->parent) {
-               global = global->parent;
+       if (client->permission_func != NULL)
                perms &= client->permission_func(global, client, 
client->permission_data);
-       }
+
        return perms;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/src/pipewire/properties.h 
new/pipewire-0.2.7/src/pipewire/properties.h
--- old/pipewire-0.2.6/src/pipewire/properties.h        2019-05-22 
11:44:12.000000000 +0200
+++ new/pipewire-0.2.7/src/pipewire/properties.h        2019-09-26 
15:58:39.000000000 +0200
@@ -40,7 +40,7 @@
 };
 
 struct pw_properties *
-pw_properties_new(const char *key, ...);
+pw_properties_new(const char *key, ...) SPA_SENTINEL;
 
 struct pw_properties *
 pw_properties_new_dict(const struct spa_dict *dict);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/src/pipewire/protocol.h 
new/pipewire-0.2.7/src/pipewire/protocol.h
--- old/pipewire-0.2.6/src/pipewire/protocol.h  2019-05-22 11:44:12.000000000 
+0200
+++ new/pipewire-0.2.7/src/pipewire/protocol.h  2019-09-26 15:58:39.000000000 
+0200
@@ -44,14 +44,14 @@
        int (*connect) (struct pw_protocol_client *client,
                        void (*done_callback) (void *data, int result),
                        void *data);
-       int (*connect_fd) (struct pw_protocol_client *client, int fd);
+       int (*connect_fd) (struct pw_protocol_client *client, int fd, bool 
close);
        int (*steal_fd) (struct pw_protocol_client *client);
        void (*disconnect) (struct pw_protocol_client *client);
        void (*destroy) (struct pw_protocol_client *client);
 };
 
 #define pw_protocol_client_connect(c,cb,d)     ((c)->connect(c,cb,d))
-#define pw_protocol_client_connect_fd(c,fd)    ((c)->connect_fd(c,fd))
+#define pw_protocol_client_connect_fd(c,fd,cl) ((c)->connect_fd(c,fd,cl))
 #define pw_protocol_client_steal_fd(c)         ((c)->steal_fd(c))
 #define pw_protocol_client_disconnect(c)       ((c)->disconnect(c))
 #define pw_protocol_client_destroy(c)          ((c)->destroy(c))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/src/pipewire/remote.c 
new/pipewire-0.2.7/src/pipewire/remote.c
--- old/pipewire-0.2.6/src/pipewire/remote.c    2019-05-22 11:44:12.000000000 
+0200
+++ new/pipewire-0.2.7/src/pipewire/remote.c    2019-09-26 15:58:39.000000000 
+0200
@@ -305,7 +305,7 @@
        spa_list_consume(stream, &remote->stream_list, link)
                pw_stream_destroy(stream);
 
-       pw_protocol_client_destroy (remote->conn);
+       pw_protocol_client_destroy(remote->conn);
 
        spa_list_remove(&remote->link);
 
@@ -413,7 +413,7 @@
 
        pw_remote_update_state(remote, PW_REMOTE_STATE_CONNECTING, NULL);
 
-       if ((res = pw_protocol_client_connect (remote->conn, done_connect, 
remote)) < 0) {
+       if ((res = pw_protocol_client_connect(remote->conn, done_connect, 
remote)) < 0) {
                pw_remote_update_state(remote, PW_REMOTE_STATE_ERROR,
                                "connect failed %s", spa_strerror(res));
                return res;
@@ -428,7 +428,7 @@
 
        pw_remote_update_state(remote, PW_REMOTE_STATE_CONNECTING, NULL);
 
-       if ((res = pw_protocol_client_connect_fd (remote->conn, fd)) < 0) {
+       if ((res = pw_protocol_client_connect_fd(remote->conn, fd, true)) < 0) {
                pw_remote_update_state(remote, PW_REMOTE_STATE_ERROR,
                                "connect_fd failed %s", spa_strerror(res));
                return res;
@@ -462,7 +462,7 @@
                pw_proxy_destroy(proxy);
        remote->core_proxy = NULL;
 
-       pw_protocol_client_disconnect (remote->conn);
+       pw_protocol_client_disconnect(remote->conn);
 
        pw_map_clear(&remote->objects);
        pw_map_clear(&remote->types);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pipewire-0.2.6/src/pipewire/remote.h 
new/pipewire-0.2.7/src/pipewire/remote.h
--- old/pipewire-0.2.6/src/pipewire/remote.h    2019-05-22 11:44:12.000000000 
+0200
+++ new/pipewire-0.2.7/src/pipewire/remote.h    2019-09-26 15:58:39.000000000 
+0200
@@ -177,7 +177,8 @@
 int pw_remote_connect(struct pw_remote *remote);
 
 /** Connect to a remote PipeWire on the given socket \memberof pw_remote
- * \param fd the connected socket to use
+ * \param fd the connected socket to use, the socket will be closed
+ *     automatically on disconnect or error.
  * \return 0 on success, < 0 on error */
 int pw_remote_connect_fd(struct pw_remote *remote, int fd);
 


Reply via email to