[PATCH] tests: Require base 10 for the string specifying the number of open fd's

Bryce Harrington bryce at osg.samsung.com
Mon Jul 11 20:53:30 UTC 2016


On Fri, Jul 08, 2016 at 07:39:33PM -0700, Yong Bakos wrote:
> On Jul 8, 2016, at 7:00 PM, Bryce Harrington <bryce at osg.samsung.com> wrote:
> > 
> > The third arg to strtol() specifies the base to assume for the number.
> > When 0 is passed, as is currently done in wayland-client.c, hexadecimal
> > and octal numbers are permitted and automatically detected and
> > converted.
> > 
> > exec-fd-leak-checker's single argument is the count of file descriptors
> > it should expect to be open.  We should expect this to be specified only
> > as a decimal number, there's no reason why one would want to use octal
> > or hexadecimal for that.
> > 
> > Suggested by Yong Bakos.
> > 
> > Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>
> 
> Reviewed-by: Yong Bakos <ybakos at humanoriented.com>
> 
> yong

Thanks, pushed.

Bryce
> 
> > ---
> > tests/exec-fd-leak-checker.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tests/exec-fd-leak-checker.c b/tests/exec-fd-leak-checker.c
> > index 0c69da3..5f3b395 100644
> > --- a/tests/exec-fd-leak-checker.c
> > +++ b/tests/exec-fd-leak-checker.c
> > @@ -37,7 +37,7 @@ parse_count(const char *str, int *value)
> > 	long v;
> > 
> > 	errno = 0;
> > -	v = strtol(str, &end, 0);
> > +	v = strtol(str, &end, 10);
> > 	if ((errno == ERANGE && (v == LONG_MAX || v == LONG_MIN)) ||
> > 	    (errno != 0 && v == 0) ||
> > 	    (end == str) ||
> > -- 
> > 1.9.1
> > 
> > _______________________________________________
> > wayland-devel mailing list
> > wayland-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list