summaryrefslogtreecommitdiffstats
path: root/rfcomm
diff options
context:
space:
mode:
Diffstat (limited to 'rfcomm')
-rw-r--r--rfcomm/Makefile.am2
-rw-r--r--rfcomm/main.c15
2 files changed, 15 insertions, 2 deletions
diff --git a/rfcomm/Makefile.am b/rfcomm/Makefile.am
index bda4a13f..8e883540 100644
--- a/rfcomm/Makefile.am
+++ b/rfcomm/Makefile.am
@@ -10,6 +10,8 @@ rfcomm_LDADD = @BLUEZ_LIBS@
AM_CFLAGS = @BLUEZ_CFLAGS@
+INCLUDES = -I$(top_srcdir)/common
+
man_MANS = rfcomm.1
AM_YFLAGS = -d
diff --git a/rfcomm/main.c b/rfcomm/main.c
index 43d52e61..5167d497 100644
--- a/rfcomm/main.c
+++ b/rfcomm/main.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif
+#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
@@ -47,6 +48,10 @@
#include "kword.h"
+#ifdef NEED_PPOLL
+#include "ppoll.h"
+#endif
+
static char *rfcomm_config_file = NULL;
static int rfcomm_raw_tty = 0;
@@ -259,6 +264,7 @@ static void cmd_connect(int ctl, int dev, bdaddr_t *bdaddr, int argc, char **arg
struct termios ti;
struct sigaction sa;
struct pollfd p;
+ sigset_t sigs;
socklen_t alen;
char dst[18], devname[MAXPATHLEN];
int sk, fd, try = 30;
@@ -378,12 +384,14 @@ static void cmd_connect(int ctl, int dev, bdaddr_t *bdaddr, int argc, char **arg
sa.sa_handler = sig_hup;
sigaction(SIGHUP, &sa, NULL);
+ sigfillset(&sigs);
+
p.fd = fd;
p.events = POLLERR | POLLHUP;
while (!__io_canceled) {
p.revents = 0;
- if (poll(&p, 1, 500))
+ if (ppoll(&p, 1, NULL, &sigs) > 0)
break;
}
@@ -399,6 +407,7 @@ static void cmd_listen(int ctl, int dev, bdaddr_t *bdaddr, int argc, char **argv
struct termios ti;
struct sigaction sa;
struct pollfd p;
+ sigset_t sigs;
socklen_t alen;
char dst[18], devname[MAXPATHLEN];
int sk, nsk, fd, try = 30;
@@ -496,12 +505,14 @@ static void cmd_listen(int ctl, int dev, bdaddr_t *bdaddr, int argc, char **argv
sa.sa_handler = sig_hup;
sigaction(SIGHUP, &sa, NULL);
+ sigfillset(&sigs);
+
p.fd = fd;
p.events = POLLERR | POLLHUP;
while (!__io_canceled) {
p.revents = 0;
- if (poll(&p, 1, 500))
+ if (ppoll(&p, 1, NULL, &sigs) > 0)
break;
}