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: edg...@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.
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



Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________

zeromq-dev mailing list

zeromq-dev@lists.zeromq.org

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

_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to