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

2016-07-11 Thread Peter Hutterer
On Mon, Jul 11, 2016 at 01:19:54PM -0700, Bryce Harrington wrote: > On Mon, Jul 11, 2016 at 09:39:00AM -0700, Bill Spitzak wrote: > > On Sun, Jul 10, 2016 at 4:28 PM, Peter Hutterer > > wrote: > > > > > On Thu, Jul 07, 2016 at 02:24:39PM -0700, Bryce Harrington wrote: > > > > On Thu, Jul 07, 2016

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

2016-07-11 Thread Peter Hutterer
On Mon, Jul 11, 2016 at 09:39:00AM -0700, Bill Spitzak wrote: > On Sun, Jul 10, 2016 at 4:28 PM, Peter Hutterer > wrote: > > > On Thu, Jul 07, 2016 at 02:24:39PM -0700, Bryce Harrington wrote: > > > On Thu, Jul 07, 2016 at 02:08:28PM -0700, Bryce Harrington wrote: > > > > Check errno, which is se

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

2016-07-11 Thread Bryce Harrington
On Mon, Jul 11, 2016 at 09:28:16AM +1000, Peter Hutterer wrote: > On Thu, Jul 07, 2016 at 02:24:39PM -0700, Bryce Harrington wrote: > > On Thu, Jul 07, 2016 at 02:08:28PM -0700, Bryce Harrington wrote: > > > Check errno, which is set of over/underflow, out of range, etc. Also > > > check for empty

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

2016-07-11 Thread Bryce Harrington
On Mon, Jul 11, 2016 at 09:39:00AM -0700, Bill Spitzak wrote: > On Sun, Jul 10, 2016 at 4:28 PM, Peter Hutterer > wrote: > > > On Thu, Jul 07, 2016 at 02:24:39PM -0700, Bryce Harrington wrote: > > > On Thu, Jul 07, 2016 at 02:08:28PM -0700, Bryce Harrington wrote: > > > > Check errno, which is se

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

2016-07-10 Thread Peter Hutterer
On Thu, Jul 07, 2016 at 02:24:39PM -0700, Bryce Harrington wrote: > On Thu, Jul 07, 2016 at 02:08:28PM -0700, Bryce Harrington wrote: > > Check errno, which is set of over/underflow, out of range, etc. Also > > check for empty strings (the usages covered in this patch already also > > cover the ca

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

2016-07-08 Thread Bryce Harrington
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') { > >

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

2016-07-08 Thread Eric Engestrom
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') { > > Is

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

2016-07-08 Thread Eric Engestrom
On Thu, Jul 07, 2016 at 02:08:28PM -0700, Bryce Harrington wrote: > Check errno, which is set of over/underflow, out of range, etc. Also > check for empty strings (the usages covered in this patch already also > cover the case where there are non-digits present). Set errno to 0 > before making th

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

2016-07-07 Thread Bryce Harrington
On Thu, Jul 07, 2016 at 02:08:28PM -0700, Bryce Harrington wrote: > Check errno, which is set of over/underflow, out of range, etc. Also > check for empty strings (the usages covered in this patch already also > cover the case where there are non-digits present). Set errno to 0 > before making th

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

2016-07-07 Thread Bryce Harrington
Check errno, which is set of over/underflow, out of range, etc. Also check for empty strings (the usages covered in this patch already also cover the case where there are non-digits present). Set errno to 0 before making the strto*l call in case of pre-existing errors (i.e. ENOTTY when running un