[PATCH weston] config-parser: Improve error checks for strtol/strtoul calls

Bryce Harrington bryce at osg.samsung.com
Fri Jul 8 18:23:24 UTC 2016


On Fri, Jul 08, 2016 at 11:33:56AM +0100, Eric Engestrom wrote:
> On Fri, Jul 08, 2016 at 10:26:43AM +0100, Eric Engestrom wrote:
> > On Thu, Jul 07, 2016 at 02:08:28PM -0700, Bryce Harrington wrote:
> > > +	errno = 0;
> > >  	*value = strtol(entry->value, &end, 0);
> > > -	if (*end != '\0') {
> > > +	if (errno != 0 || end == entry->value || *end != '\0') {
> > 
> > Isn't the empty string case already covered by `*end != '\0'` ?
> 
> No, it's not: I misread that.
> I just re-read the patch, now that I'm a bit more awake, and my r-b
> still stands :)
> 
> > Either way, the duplicate test wouldn't hurt, so:
> > Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

Thanks again, pushed.

Bryce


More information about the wayland-devel mailing list