summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothserver_bluez.cpp
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@theqtcompany.com>2015-02-16 18:20:13 +0100
committerAlex Blasche <alexander.blasche@theqtcompany.com>2015-02-17 12:38:48 +0000
commit6ea1e538b79a08d370660b1237c6ed6baaf82bce (patch)
tree9831113e60988ab3bb97caf3810b219b7b93f196 /src/bluetooth/qbluetoothserver_bluez.cpp
parentf0bef22496de7d09c1b2ead685ae263dd28f4388 (diff)
Set QBluetoothServer::ServiceAlreadyRegisteredError where possible
This affects Bluez 4 & 5. Task-number: QTBUG-44452 Change-Id: Ifa9f6c56499bece3d99dba65a0afeed6c2ed60ac Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/bluetooth/qbluetoothserver_bluez.cpp')
-rw-r--r--src/bluetooth/qbluetoothserver_bluez.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/bluetooth/qbluetoothserver_bluez.cpp b/src/bluetooth/qbluetoothserver_bluez.cpp
index 88eab65c..c6ce77a3 100644
--- a/src/bluetooth/qbluetoothserver_bluez.cpp
+++ b/src/bluetooth/qbluetoothserver_bluez.cpp
@@ -151,9 +151,11 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port)
else
convertAddress(device.address().toUInt64(), addr.rc_bdaddr.b);
-
if (::bind(sock, reinterpret_cast<sockaddr *>(&addr), sizeof(sockaddr_rc)) < 0) {
- d->m_lastError = InputOutputError;
+ if (errno == EADDRINUSE)
+ d->m_lastError = ServiceAlreadyRegisteredError;
+ else
+ d->m_lastError = InputOutputError;
emit error(d->m_lastError);
return false;
}