summaryrefslogtreecommitdiff
path: root/sd/source/ui/remotecontrol/BluetoothServer.cxx
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2013-05-22 00:49:57 +0200
committerFridrich Strba <fridrich@documentfoundation.org>2013-05-22 05:04:40 +0000
commit44a7759b2971c326852d0fb24cf6ea4a540a28f1 (patch)
treea98c4ce74f0de65115e33bf1dde4148ce6c71f25 /sd/source/ui/remotecontrol/BluetoothServer.cxx
parent563f15a609f5c637cd73d831830a68bdb61fb4d8 (diff)
valgrind: Initialize all of struct sockaddr_rc for binding AF_BLUETOOTH.
valgrind doesn't know that struct sockaddr_rc contains some padding that isn't used. Since we pass bind sizeof (struct sockaddr_rc) valgrind will check all bytes are initialized. So explicitly clear all bytes before passing to bind. https://bugs.kde.org/show_bug.cgi?id=320116 tracks adding explicit support to valgrind. Change-Id: I05d2f221a5794228dae3077e8ea1bcda5ba1f8b0 Reviewed-on: https://gerrit.libreoffice.org/3998 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'sd/source/ui/remotecontrol/BluetoothServer.cxx')
-rw-r--r--sd/source/ui/remotecontrol/BluetoothServer.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx
index c87f1b82fb10..f5426d80aced 100644
--- a/sd/source/ui/remotecontrol/BluetoothServer.cxx
+++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx
@@ -224,9 +224,13 @@ bluezCreateAttachListeningSocket( GMainContext *pContext, GPollFD *pSocketFD )
}
sockaddr_rc aAddr;
+ // Initialize whole structure. Mainly to appease valgrind, which
+ // doesn't know about the padding at the end of sockaddr_rc which
+ // it will dutifully check for definedness. But also the standard
+ // definition of BDADDR_ANY is unusable in C++ code, so just use
+ // memset to set aAddr.rc_bdaddr to 0.
+ memset( &aAddr, 0, sizeof( aAddr ) );
aAddr.rc_family = AF_BLUETOOTH;
- // BDADDR_ANY is broken, so use memset to set to 0.
- memset( &aAddr.rc_bdaddr, 0, sizeof( aAddr.rc_bdaddr ) );
aAddr.rc_channel = 5;
int a;