|
From: Anders J. <and...@us...> - 2001-10-16 16:37:52
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bt_if.c 1.40 1.41=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* bt_testcmd should now return correct errorcodes.
* bt_isconnected accepts -1 as filedescriptor and will then open the=20
controltty to allow the ioctl to be sent.
The diff of the modified file(s):
--- bt_if.c 2001/10/15 08:48:53 1.40
+++ bt_if.c 2001/10/16 16:15:34 1.41
@@ -328,11 +328,12 @@
}
=20
/* Check whether this line is lower connected in stack (rfcomm ready) */
-int bt_isconnected(int bt_fd, int line)
+int bt_isconnected(int bt_cfd, int line)
{
+ int fd =3D (bt_cfd < 0 ? bt_openctrl() : bt_cfd);
int ret;
#ifndef BT_USERSTACK
- if ((ret =3D ioctl(bt_fd, BTISLOWERCONNECTED, &line)) < 0)
+ if (fd < 0 || (ret =3D ioctl(fd, BTISLOWERCONNECTED, &line)) < 0)
{
perror(__FUNCTION__);
exit(1);
@@ -341,6 +342,10 @@
fprintf(stderr, __FUNCTION__ ": not yet implemented...\n");
ret =3D -1;
#endif
+ if (bt_cfd < 0)
+ {
+ close(fd);
+ }
return ret;
}
=20
@@ -613,7 +618,7 @@
else
printf("Success!\n");
#else
- test_process_cmd(&tmp[1], tmp[0]);
+ ret_val =3D test_process_cmd(&tmp[1], tmp[0]);
#endif
return ret_val;
}
|