From: shingil.kang Date: Mon, 16 Nov 2015 12:05:24 +0000 (+0900) Subject: Fixes for issues reported by Static Code Analysis X-Git-Tag: submit/tizen/20160201.065657~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F39%2F58439%2F1;p=sdk%2Ftarget%2Fsdbd.git Fixes for issues reported by Static Code Analysis - Variable atomicity - Bad sizeof usage Change-Id: I07f780ad12be2e74176965cabaa1a810ef0893da Signed-off-by: shingil.kang --- diff --git a/src/transport.c b/src/transport.c index e63e5d6..c4b64d7 100644 --- a/src/transport.c +++ b/src/transport.c @@ -170,7 +170,7 @@ static int write_packet(int fd, const char* name, apacket** ppacket) { char *p = (char*) ppacket; /* we really write the packet address */ - int r, len = sizeof(ppacket); + int r, len = sizeof(apacket*); char buff[8]; if (!name) { snprintf(buff, sizeof buff, "fd=%d", fd); @@ -182,7 +182,6 @@ write_packet(int fd, const char* name, apacket** ppacket) dump_packet(name, "to remote", *ppacket); } #endif - len = sizeof(ppacket); while(len > 0) { r = sdb_write(fd, p, len); if(r > 0) { @@ -748,7 +747,6 @@ atransport *acquire_one_transport(int state, transport_type ttype, const char* s atransport *result = NULL; int ambiguous = 0; -retry: if (error_out) *error_out = "device not found"; @@ -797,7 +795,6 @@ retry: } } } - sdb_mutex_unlock(&transport_lock); if (result) { /* offline devices are ignored -- they are either being born or dying */ @@ -818,11 +815,9 @@ retry: /* found one that we can take */ if (error_out) *error_out = NULL; - } else if (state != CS_ANY && (serial || !ambiguous)) { - sdb_sleep_ms(1000); - goto retry; } + sdb_mutex_unlock(&transport_lock); return result; }