Fix #9678
closed
errno shadowed in Pipe.cc
Added by Loïc Dachary over 9 years ago.
Updated about 5 years ago.
Description
In some places errno is used after it has been reset and the original error code does not show in the message. For instance https://github.com/ceph/ceph/blob/giant/src/msg/Pipe.cc#L1473
2014-10-07 14:37:05.473776 7facdbf15700 2 -- 192.168.99.252:6805/25809 >> 192.168.99.251:0/2012331 pipe(0x7fad20850800 sd=138 :6805 s=4 pgs=47 cs=1 l=1 c=0x7fad22fa1b20).reader couldn't read tag, (0) Success
- Subject changed from errno shadowd in Pipe.cc to errno shadowed in Pipe.cc
- Backport set to firefly, giant
Where's it being reset? That error message is admittedly strange but it actually happens because the underlying function can return without it being an error. (I don't remember exactly how, but I think it's if the other end closes a socket we wake up without error codes but then we return -1 because there's no data available to read.)
- Priority changed from High to Normal
- Backport deleted (
firefly, giant)
If it is expected to see an error message when there is nothing to read, then I was mistaken.
Not retrieving the content of errno opens the possibility that other system calls happen in between (if not now then when the code being called in between evolve), making it unreliable to read afterwards.
Feel free to reject if you think this is not a concern.
- Status changed from 12 to Rejected
- Project changed from Ceph to Messengers
- Category deleted (
msgr)
Also available in: Atom
PDF