Tobias Stoeckmann wrote:
> Opinions, thoughts?
> 
> > [...]
> > 
> > Index: sbin/newfs/newfs.c
> > ===================================================================
> > RCS file: /cvs/src/sbin/newfs/newfs.c,v
> > retrieving revision 1.100
> > diff -u -p -u -p -r1.100 newfs.c
> > --- sbin/newfs/newfs.c      29 Sep 2015 03:19:24 -0000      1.100
> > +++ sbin/newfs/newfs.c      7 Nov 2015 11:16:26 -0000
> > @@ -410,7 +410,7 @@ main(int argc, char *argv[])
> >                                 special);
> >             }
> >             cp = strchr(argv[0], '\0') - 1;
> > -           if (cp == NULL ||
> > +           if (cp == NULL || cp < argv[0] ||
> >                 ((*cp < 'a' || *cp > ('a' + maxpartitions - 1))
> >                 && !isdigit((unsigned char)*cp)))
> >                     fatal("%s: can't figure out file system partition",

Why not just use *argv[0] == '\0' in the condition? Seems clearer to me.

ok mmcc@ for that hunk either way.

It could also be nicer to break that out into its own condition and make
the error message something like "Empty partition name supplied".

Reply via email to