[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] inet_listen_opts: add error checking
From: |
Gerd Hoffmann |
Subject: |
Re: [Qemu-devel] [PATCH] inet_listen_opts: add error checking |
Date: |
Thu, 12 Dec 2013 13:27:24 +0100 |
Hi,
> > + if (port_offset) {
> > + int baseport;
> > + errno = 0;
> > + baseport = strtol(port, NULL, 10);
> <rant>
> WHY is strtol() such a PAINFUL interface to use correctly?
Crossed my mind too after reading the manpage, which sayed you should
clear errno to reliable detect errors as checking the return value
doesn't cut it.
Your points obviously underline that.
> And WHY
> can't qemu copy libvirt's lead of writing a SANE wrapper function, and
> then mandating that the rest of the code base use the sane wrapper
> instead of strtol()?
> </rant>
Care to share a pointer to the code?
thanks,
Gerd