[zeromq-dev] ZMQ vs SPI: FD shenanigans

Ed Griffiths edgrif at sanger.ac.uk
Thu Jan 22 14:26:15 CET 2015


Hi,

It is a well known bug to be checking the errno value without first checking 
that the system call failed. The errno number has no meaning _unless_ the system 
call failed, it doesn't matter what it's value is if there hasn't been an error.

Hope that helps...

Ed
-- 
  ------------------------------------------------------------------------
| Ed Griffiths, Acedb/ZMap development, Computational Genomics Group,    |
|  The Sulston Building, Sanger Institute, Wellcome Trust Genome Campus, |
|  Hinxton, Cambridge CB10 1HH                                           |
|                                                                        |
| email: edgrif at sanger.ac.uk  Tel: +44-1223-496844  Fax: +44-1223-494919 |
  ------------------------------------------------------------------------


-- 
 The Wellcome Trust Sanger Institute is operated by Genome Research 
 Limited, a charity registered in England with number 1021457 and a 
 company registered in England with number 2742969, whose registered 
 office is 215 Euston Road, London, NW1 2BE. 
-------------- next part --------------
Hello,



Am 21.01.2015 22:31, schrieb KIU Shueng Chuan:

> Are you sure that the ioctl call failed? You are printing out errno wit
hout

> having checked the return code of the ioctl call.

-Snipp-



that actually was the problem!!! My own code had more debug checks to

verify that none of the previous calls failed. But that debug code never

checked the contents of errno before the end!



zmq_bind() may return successfully (zmq_bind() == 0), but it still

leaves errno non-equal to zero. And in my "real" program I didn't use

the return code of the ioctl call but the errno value.



Thank you for helping me find this!



Now the question: is it proper behaviour of zmq_bind() to change errno

to a non-success value and then return successfully? Or should ZMQ

everywhere that it works around "temporary" errors reset errno to zero

on success?



Best regards,

Olaf Mandel

-- 

Olaf Mandel

phone: +49-89-189166-250

fax:   +49-89-189166-111

Menlo Systems GmbH

Am Klopferspitz 19a, D-82152 Martinsried

Amtsgericht M?nchen HRB 138145

Gesch?ftsf?hrung: Dr Michael Mei, Dr Ronald Holzwarth

USt-IdNr. DE217772017, St.-Nr. 14316170324



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150122/742f09dd/attachment.sig>
-------------- next part --------------
_______________________________________________

zeromq-dev mailing list

zeromq-dev at lists.zeromq.org

http://lists.zeromq.org/mailman/listinfo/zeromq-dev



More information about the zeromq-dev mailing list