Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] btmgmt: fix used without initialization
@ 2011-11-07 16:58 Claudio Takahasi
  2011-11-07 19:36 ` Johan Hedberg
  0 siblings, 1 reply; 3+ messages in thread
From: Claudio Takahasi @ 2011-11-07 16:58 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

This patch fixes the following warning being treated as error:
mgmt/main.c: In function 'mgmt_process_data':
mgmt/main.c:508:3: error: 'len' may be used uninitialized in this
function [-Werror=uninitialized]
---
 mgmt/main.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/mgmt/main.c b/mgmt/main.c
index c970f62..d939cca 100644
--- a/mgmt/main.c
+++ b/mgmt/main.c
@@ -504,8 +504,10 @@ static int mgmt_process_data(int mgmt_sk)
 
 	ret = read(mgmt_sk, buf, sizeof(buf));
 	if (ret < 0) {
-		fprintf(stderr, "read: %s\n", strerror(errno));
-		return len;
+		int err = errno;
+
+		fprintf(stderr, "read: %s\n", strerror(err));
+		return -err;
 	}
 
 	if (ret < MGMT_HDR_SIZE) {
-- 
1.7.7.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-07 20:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-07 16:58 [PATCH BlueZ] btmgmt: fix used without initialization Claudio Takahasi
2011-11-07 19:36 ` Johan Hedberg
2011-11-07 20:08   ` Anderson Lizardo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox