Date: Tue, 4 Jan 2011 08:05:59 -0500 From: John Baldwin <jhb@freebsd.org> To: freebsd-hackers@freebsd.org Cc: Kostik Belousov <kostikbel@gmail.com>, Eitan Adler <lists@eitanadler.com>, hackers@freebsd.org, Giorgos Keramidas <keramida@freebsd.org> Subject: Re: [patch] have rtprio check that arguments are numeric; change atoi to strtol Message-ID: <201101040805.59412.jhb@freebsd.org> In-Reply-To: <20110104112502.GM3140@deviant.kiev.zoral.com.ua> References: <AANLkTimiJPiHBSw5i5TVJYfh9uGOyrNJx%2BoUPeB%2Bt%2BY_@mail.gmail.com> <xeia7heluf2q.fsf@kobe.laptop> <20110104112502.GM3140@deviant.kiev.zoral.com.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, January 04, 2011 6:25:02 am Kostik Belousov wrote: > On Tue, Jan 04, 2011 at 11:40:45AM +0100, Giorgos Keramidas wrote: > @@ -123,12 +121,28 @@ main(argc, argv) > } > exit(0); > } > - exit (1); > + exit(1); > +} > + > +static int > +parseint(const char *str, const char *errname) > +{ > + char *endp; > + long res; > + > + errno = 0; > + res = strtol(str, &endp, 10); > + if (errno != 0 || endp == str || *endp != '\0') > + err(1, "%s shall be a number", errname); Small nit, maybe use 'must' instead of 'shall'. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101040805.59412.jhb>