summaryrefslogtreecommitdiffstats
path: root/tools/ciptool.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-08-16 10:54:06 +0000
committerMarcel Holtmann <marcel@holtmann.org>2006-08-16 10:54:06 +0000
commita1bc48d15a5d6e78efe744eb7b27b6421cb7222f (patch)
treea7880f87c2585311975e4087d36255c9f1f0b7ec /tools/ciptool.c
parenta23442be507d9384175898a28fb72c35f790fbd1 (diff)
Convert to using ppoll() and pselect()
Diffstat (limited to 'tools/ciptool.c')
-rw-r--r--tools/ciptool.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/ciptool.c b/tools/ciptool.c
index 97dcb62d..3f4b113f 100644
--- a/tools/ciptool.c
+++ b/tools/ciptool.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif
+#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
@@ -44,6 +45,10 @@
#include <bluetooth/sdp_lib.h>
#include <bluetooth/cmtp.h>
+#ifdef NEED_PPOLL
+#include "ppoll.h"
+#endif
+
static volatile sig_atomic_t __io_canceled = 0;
static void sig_hup(int sig)
@@ -331,6 +336,7 @@ static void cmd_loopback(int ctl, bdaddr_t *bdaddr, int argc, char **argv)
struct cmtp_conndel_req req;
struct sigaction sa;
struct pollfd p;
+ sigset_t sigs;
bdaddr_t src, dst;
unsigned short psm;
int dev_id, sk;
@@ -375,12 +381,14 @@ static void cmd_loopback(int ctl, bdaddr_t *bdaddr, int argc, char **argv)
sa.sa_handler = sig_hup;
sigaction(SIGHUP, &sa, NULL);
+ sigfillset(&sigs);
+
p.fd = sk;
p.events = POLLERR | POLLHUP;
while (!__io_canceled) {
p.revents = 0;
- if (poll(&p, 1, 500))
+ if (ppoll(&p, 1, NULL, &sigs) > 0)
break;
}