diff options
-rw-r--r-- | audio/pcm_bluetooth.c | 7 | ||||
-rw-r--r-- | audio/unix.c | 10 |
2 files changed, 12 insertions, 5 deletions
diff --git a/audio/pcm_bluetooth.c b/audio/pcm_bluetooth.c index 10182993..42c1e557 100644 --- a/audio/pcm_bluetooth.c +++ b/audio/pcm_bluetooth.c @@ -346,11 +346,11 @@ static int bluetooth_recvmsg_fd(struct bluetooth_data *data) return -err; } - if(pkt.type == PKT_TYPE_CFG_RSP) { + if (pkt.type == PKT_TYPE_CFG_RSP) { struct cmsghdr *cmsg; /* Receive auxiliary data in msgh */ for (cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL; - cmsg = CMSG_NXTHDR(&msgh,cmsg)) { + cmsg = CMSG_NXTHDR(&msgh,cmsg)) { if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) data->cfg.fd = (*(int *) CMSG_DATA(cmsg)); @@ -442,7 +442,8 @@ static int bluetooth_cfg(struct bluetooth_data *data) goto done; } - if ((ret = bluetooth_recvmsg_fd(data)) < 0) + ret = bluetooth_recvmsg_fd(data); + if (ret < 0) goto done; /* It is possible there is some outstanding diff --git a/audio/unix.c b/audio/unix.c index 00f146be..163f4f98 100644 --- a/audio/unix.c +++ b/audio/unix.c @@ -72,7 +72,7 @@ static int unix_sendmsg_fd(int sock, int fd, struct ipc_packet *pkt) cmsg->cmsg_type = SCM_RIGHTS; cmsg->cmsg_len = CMSG_LEN(sizeof(int)); /* Initialize the payload */ - (*(int *)CMSG_DATA(cmsg)) = fd; + (*(int *) CMSG_DATA(cmsg)) = fd; return sendmsg(sock, &msgh, MSG_NOSIGNAL); } @@ -100,9 +100,14 @@ static gboolean unix_event(GIOChannel *chan, GIOCondition cond, gpointer data) memset(&addr, 0, sizeof(addr)); addrlen = sizeof(addr); + clisk = accept(sk, (struct sockaddr *) &addr, &addrlen); + if (clisk < 0) { + error("accept: %s (%d)", strerror(errno), errno); + return TRUE; + } + len = sizeof(struct ipc_packet) + sizeof(struct ipc_data_cfg); pkt = g_malloc0(len); - clisk = accept(sk, (struct sockaddr *) &addr, &addrlen); len = recv(clisk, pkt, len, 0); debug("path %s len %d", addr.sun_path + 1, len); @@ -128,6 +133,7 @@ static gboolean unix_event(GIOChannel *chan, GIOCondition cond, gpointer data) len = send(clisk, pkt, len, 0); if (len < 0) info("Error %s(%d)", strerror(errno), errno); + info("%d bytes sent", len); if (cfg->fd != -1) { |