* [PATCH] avdtp: check if the socket is valid
@ 2011-10-18 20:03 Gustavo F. Padovan
2011-10-20 11:19 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo F. Padovan @ 2011-10-18 20:03 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Gustavo F. Padovan
From: "Gustavo F. Padovan" <padovan@profusion.mobi>
---
audio/avdtp.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/audio/avdtp.c b/audio/avdtp.c
index d3568ba..08860d2 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -523,6 +523,8 @@ static gboolean avdtp_send(struct avdtp *session, uint8_t transaction,
}
sock = g_io_channel_unix_get_fd(session->io);
+ if (!sock)
+ return FALSE;
/* Single packet - no fragmentation */
if (sizeof(struct avdtp_single_header) + len <= session->omtu) {
--
1.7.6.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] avdtp: check if the socket is valid
2011-10-18 20:03 [PATCH] avdtp: check if the socket is valid Gustavo F. Padovan
@ 2011-10-20 11:19 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2011-10-20 11:19 UTC (permalink / raw)
To: Gustavo F. Padovan; +Cc: linux-bluetooth
Hi Gustavo,
On Tue, Oct 18, 2011, Gustavo F. Padovan wrote:
> ---
> audio/avdtp.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/audio/avdtp.c b/audio/avdtp.c
> index d3568ba..08860d2 100644
> --- a/audio/avdtp.c
> +++ b/audio/avdtp.c
> @@ -523,6 +523,8 @@ static gboolean avdtp_send(struct avdtp *session, uint8_t transaction,
> }
>
> sock = g_io_channel_unix_get_fd(session->io);
> + if (!sock)
> + return FALSE;
>
> /* Single packet - no fragmentation */
> if (sizeof(struct avdtp_single_header) + len <= session->omtu) {
You'll need to give some more background when you're seeing this.
session->io should be set to NULL if we don't have a proper socket
available. Also, "if (!sock)" sounds like a weird check for a file
descriptor or socket where 0 is a valid value (typically reserved for
stdin but could get reused for something else in case a daemon-like
process has closed stdin, stdout and stderr). I.e. a validity check for
such a variable should be if (sock < 0), but as I said in this case you
should really investigate why session->io isn't NULL.
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-10-20 11:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-18 20:03 [PATCH] avdtp: check if the socket is valid Gustavo F. Padovan
2011-10-20 11:19 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox