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);
dump_packet(name, "to remote", *ppacket);
}
#endif
- len = sizeof(ppacket);
while(len > 0) {
r = sdb_write(fd, p, len);
if(r > 0) {
atransport *result = NULL;
int ambiguous = 0;
-retry:
if (error_out)
*error_out = "device not found";
}
}
}
- sdb_mutex_unlock(&transport_lock);
if (result) {
/* offline devices are ignored -- they are either being born or dying */
/* 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;
}