ignoring NEGOTIATE_UNIX_FD

Thiago Macieira thiago at kde.org
Wed Nov 7 15:57:37 PST 2012


On quarta-feira, 7 de novembro de 2012 16.46.54, Martin Vidner wrote:
> > Remember that the library dup()s the file descriptor before giving it to
> > you.  You need to remember to close it later, otherwise you'll leak them.
> Also note that the integers in the message are not the FDs. The spec says:
>   
>         UNIX_FD: 32-bit unsigned integer in the message's byte order. The
>         actual file descriptors need to be transferred out-of-band via some
>         platform specific mechanism. On the wire, values of this type store
>         the index to the file descriptor in the array of file descriptors
>         that accompany the message.

The integers in the message are not the integers that the API gives you. The 
library converts the index into the Unix ancillary data to a real file 
descriptor, which you *must* close.

If you get it twice from the library using the API, you'll get two different 
values and they must both be closed.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20121108/53af5904/attachment.pgp>


More information about the dbus mailing list