[Libreoffice-commits] core.git: sd/source

Mark Wielaard mark at klomp.org
Tue May 21 22:04:59 PDT 2013


 sd/source/ui/remotecontrol/BluetoothServer.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 44a7759b2971c326852d0fb24cf6ea4a540a28f1
Author: Mark Wielaard <mark at klomp.org>
Date:   Wed May 22 00:49:57 2013 +0200

    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 at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx
index c87f1b8..f5426d8 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;


More information about the Libreoffice-commits mailing list