|
From: Peter K. <pk...@us...> - 2001-03-13 22:19:16
|
The following files were modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bt_if.c 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20
btd.c 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20
btinit.c 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20
btsend.c 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20
modememul.c 1.2 1.3=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added O_NOCTTY flag to all open() calls of any /dev/ttyBT* device to
make sure we do not accidentally end up with one as controlling TTY.
The diff of the modified file(s):
--- bt_if.c 2001/03/02 10:59:57 1.1
+++ bt_if.c 2001/03/13 22:21:17 1.2
@@ -95,7 +95,7 @@
=20
int bt_isinitiated(void)
{
- int bt_cfd =3D open(BT_CTRL_TTY, O_RDWR);
+ int bt_cfd =3D open(BT_CTRL_TTY, O_RDWR | O_NOCTTY);
int stack_initiated =3D -1;
=20
if (ioctl(bt_cfd, BTISINITIATED, &stack_initiated) < 0)
@@ -135,7 +135,7 @@
int devfd;
=20
printf("Resetting HW board...\n");
- if ((devfd =3D open(BT_CTRL_TTY, O_RDWR)) >=3D 0)
+ if ((devfd =3D open(BT_CTRL_TTY, O_RDWR | O_NOCTTY)) >=3D 0)
{
if (ioctl(devfd, BTRESETPHYSICALHW) < 0)
{
@@ -162,7 +162,7 @@
{
int bt_cfd;
printf("Now opening BT Ctrl TTY [%s]\n", BT_CTRL_TTY);
- if ((bt_cfd =3D open(BT_CTRL_TTY, O_RDWR)) < 0)
+ if ((bt_cfd =3D open(BT_CTRL_TTY, O_RDWR | O_NOCTTY)) < 0)
{
printf("could not open %s\n", BT_CTRL_TTY);
exit(1);
@@ -790,6 +790,7 @@
int open_device(char* dev, int flags, int role)
{
int fd;
+
#ifdef BT_USERSTACK=20=20
/* if opening bt dev or control dev simply discard and return fake fd */
if ((strcmp(dev, btdev)=3D=3D0) || (strcmp(dev, BT_CTRL_TTY)=3D=3D0) )
@@ -802,7 +803,7 @@
#endif=20=20
=20
syslog(LOG_INFO, "Opening dev %s\n", dev);
- if ((fd =3D open(dev, flags)) < 0 )
+ if ((fd =3D open(dev, flags | O_NOCTTY)) < 0)
{=20
perror("open_device");
exit(1);
@@ -821,6 +822,7 @@
if (fd !=3D 0xb055e)
close(fd);
#else
+ if (fd !=3D -1)
close(fd);
#endif
}
--- btd.c 2001/03/09 15:57:33 1.3
+++ btd.c 2001/03/13 22:21:17 1.4
@@ -264,7 +264,7 @@
if (do_reset)
reset_hw();
=20=20=20
- if ((phys_fd =3D open(physdev, O_RDWR)) < 0)
+ if ((phys_fd =3D open(physdev, O_RDWR | O_NOCTTY)) < 0)
{
perror("could not open phys dev\n");
exit(1);
@@ -275,7 +275,7 @@
/* Set the current tty to the bluetooth discpline */
set_bt_line_disc(phys_fd, bt_disc, physdev);
=20=20=20
- bt_cfd =3D open(BT_CTRL_TTY, O_RDWR);
+ bt_cfd =3D open(BT_CTRL_TTY, O_RDWR | O_NOCTTY);
=20=20=20
init_stack(bt_cfd, atoi(speedstr));
=20=20=20
--- btinit.c 2001/03/02 10:59:57 1.1
+++ btinit.c 2001/03/13 22:21:17 1.2
@@ -198,7 +198,7 @@
if (do_reset)
reset_hw();
=20
- if ((phys_fd =3D open(physdev, O_RDWR)) < 0)
+ if ((phys_fd =3D open(physdev, O_RDWR | O_NOCTTY)) < 0)
{
perror("could not open phys dev\n");
exit(1);
@@ -210,7 +210,7 @@
/* Set the current tty to the bluetooth discpline */
set_bt_line_disc(phys_fd, bt_disc, physdev);
=20=20=20
- bt_cfd =3D open(BT_CTRL_TTY, O_RDWR);
+ bt_cfd =3D open(BT_CTRL_TTY, O_RDWR | O_NOCTTY);
=20
init_stack(bt_cfd, atoi(speedstr));
=20
--- btsend.c 2001/03/02 10:59:57 1.1
+++ btsend.c 2001/03/13 22:21:17 1.2
@@ -119,7 +119,7 @@
/* Open BT device */=20=20
=20
printf("Opening %s\n", btdev);
- if ((bt_fd =3D open(btdev, O_RDWR, CLIENT)) < 0)
+ if ((bt_fd =3D open(btdev, O_RDWR | O_NOCTTY, CLIENT)) < 0)
{
printf("could not open %s\n", btdev);
exit(1);
--- modememul.c 2001/03/05 11:17:24 1.2
+++ modememul.c 2001/03/13 22:21:17 1.3
@@ -119,7 +119,7 @@
while (done!=3DSTART_PPP)
{
syslog(LOG_INFO, "Open %s", argv[1]);
- if ((btfd =3D open(argv[1], O_RDWR)) < 0)
+ if ((btfd =3D open(argv[1], O_RDWR | O_NOCTTY)) < 0)
{
perror("open");
exit(1);
|