summaryrefslogtreecommitdiff
path: root/tools/hciattach.c
diff options
context:
space:
mode:
authorDoHyun Pyun <dh79.pyun@samsung.com>2015-06-08 17:17:10 +0900
committerDoHyun Pyun <dh79.pyun@samsung.com>2015-06-08 20:46:56 +0900
commit82c1ec306908f5d6d4cd9ca328d3fbe7ebac92d3 (patch)
tree94cd4766383381127b03f8de9b66b4b3ecb19a4d /tools/hciattach.c
parentc270b3c99f32d1ce10b8552822b9353ab9a0484a (diff)
downloadbluez-82c1ec306908f5d6d4cd9ca328d3fbe7ebac92d3.tar.gz
bluez-82c1ec306908f5d6d4cd9ca328d3fbe7ebac92d3.tar.bz2
bluez-82c1ec306908f5d6d4cd9ca328d3fbe7ebac92d3.zip
Upgrade Bluez 5.28 and synchronize Tizen 2.4's bluez
Change-Id: Ifaf2154ba0ab19b180946e0d92f1817a1d9ed839 Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
Diffstat (limited to 'tools/hciattach.c')
-rw-r--r--tools/hciattach.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/tools/hciattach.c b/tools/hciattach.c
index 3535faa7..150c5d04 100644
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
@@ -45,9 +45,9 @@
#include <sys/param.h>
#include <sys/ioctl.h>
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/hci.h>
-#include <bluetooth/hci_lib.h>
+#include "lib/bluetooth.h"
+#include "lib/hci.h"
+#include "lib/hci_lib.h"
#include "hciattach.h"
@@ -1315,7 +1315,7 @@ static int init_uart(char *dev, struct uart_t *u, int send_break, int raw)
if (tcgetattr(fd, &ti) < 0) {
perror("Can't get port settings");
- return -1;
+ goto fail;
}
cfmakeraw(&ti);
@@ -1331,13 +1331,13 @@ static int init_uart(char *dev, struct uart_t *u, int send_break, int raw)
if (tcsetattr(fd, TCSANOW, &ti) < 0) {
perror("Can't set port settings");
- return -1;
+ goto fail;
}
/* Set initial baudrate */
if (set_speed(fd, &ti, u->init_speed) < 0) {
perror("Can't set initial baud rate");
- return -1;
+ goto fail;
}
tcflush(fd, TCIOFLUSH);
@@ -1358,39 +1358,43 @@ static int init_uart(char *dev, struct uart_t *u, int send_break, int raw)
#endif
if (u->init && u->init(fd, u, &ti) < 0)
- return -1;
+ goto fail;
tcflush(fd, TCIOFLUSH);
/* Set actual baudrate */
if (set_speed(fd, &ti, u->speed) < 0) {
perror("Can't set baud rate");
- return -1;
+ goto fail;
}
/* Set TTY to N_HCI line discipline */
i = N_HCI;
if (ioctl(fd, TIOCSETD, &i) < 0) {
perror("Can't set line discipline");
- return -1;
+ goto fail;
}
if (flags && ioctl(fd, HCIUARTSETFLAGS, flags) < 0) {
perror("Can't set UART flags");
- return -1;
+ goto fail;
}
if (ioctl(fd, HCIUARTSETPROTO, u->proto) < 0) {
perror("Can't set device");
- return -1;
+ goto fail;
}
#if 0
if (u->post && u->post(fd, u, &ti) < 0)
- return -1;
+ goto fail;
#endif
return fd;
+
+fail:
+ close(fd);
+ return -1;
}
#endif /* __BROADCOM_PATCH__ */
@@ -1530,7 +1534,7 @@ int main(int argc, char *argv[])
dev[0] = 0;
if (!strchr(opt, '/'))
strcpy(dev, "/dev/");
- strncat(dev, opt, PATH_MAX);
+ strcat(dev, opt);
break;
case 1: