On 07/26/2016 05:42 PM, Max Reitz wrote:
>> +++ b/block/raw-posix.c
>> > @@ -485,6 +485,7 @@ static int raw_open_common(BlockDriverState *bs, QDict
>> > *options,
>> > s->fd = -1;
>> > fd = qemu_open(filename, s->open_flags, 0644);
>> > if (fd < 0) {
>> > + error_setg_errno(errp, errno, "Could not open file");
> We don't guarantee that error_setg_errno() does not modify errno. (In
> practice it should not, but we don't guarantee that.)
> Thank you very much for your review. I have double checked, and I remembered correctly: error_setg_errno saves and restores the original errno, so that is why I assumed it does not. > Therefore, the common pattern is to save the errno value before calling > this function, i.e. to put the function call... > >> > ret = -errno; > ...here. > > With that fixed, the patch should be good. > > Max > But now that you have this pointed out, I understand, it is better to have no function calls between failure and saving the errno. I will post a v3 and keep this in mind for the future. Sorry for the extra work. Frankly, I'm a bit uncomfortable with asking (do not want to be pushy), but do you have an opinion on the 'error_report_err' issue (pointed out in the cover letter part)? Cheers, Halil
signature.asc
Description: OpenPGP digital signature
