Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 03 Nov 2017 06:45:10 -0700
From:      Cy Schubert <Cy.Schubert@komquats.com>
To:        Cy Schubert <Cy.Schubert@komquats.com>
Cc:        Cy Schubert <cy@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r325357 - head/lib/libc/stdio
Message-ID:  <201711031345.vA3DjAPC041708@slippy.cwsent.com>
In-Reply-To: Message from Cy Schubert <Cy.Schubert@komquats.com> of "Fri, 03 Nov 2017 06:15:06 -0700." <201711031315.vA3DF6Oc041175@slippy.cwsent.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In message <201711031315.vA3DF6Oc041175@slippy.cwsent.com>, Cy Schubert 
writes:
> In message <201711031308.vA3D8Tj1051559@repo.freebsd.org>, Cy Schubert 
> writes:
> > Author: cy
> > Date: Fri Nov  3 13:08:29 2017
> > New Revision: 325357
> > URL: https://svnweb.freebsd.org/changeset/base/325357
> > 
> > Log:
> >   While discussing the new gets_s.c in D12785, ed@ suggested putting
> >   {}'s around the if (c == EOF) block to prevent potential 'trailing else'
> >   issues from being introduced when refactoring. As my gets_s() code
> >   is based on this, it makes sense to fix the same issue here first
> >   here and now, then do an svn copy again to capture this history).
> >   
> >   Suggested by:	ed@ in D12785
> > 
> > Modified:
> >   head/lib/libc/stdio/gets.c
> > 
> > Modified: head/lib/libc/stdio/gets.c
> > ===========================================================================
> ==
> > =
> > --- head/lib/libc/stdio/gets.c	Fri Nov  3 12:52:59 2017	(r32535
> > 6)
> > +++ head/lib/libc/stdio/gets.c	Fri Nov  3 13:08:29 2017	(r32535
> > 7)
> > @@ -61,13 +61,13 @@ gets(char *buf)
> >  		warned = 1;
> >  	}
> >  	for (s = buf; (c = __sgetc(stdin)) != '\n'; ) {
> > -		if (c == EOF)
> > +		if (c == EOF) {
> >  			if (s == buf) {
> >  				ret = NULL;
> >  				goto end;
> >  			} else
> >  				break;
> > -		else
> > +		} else
> >  			*s++ = c;
> >  	}
> >  	*s = 0;
> 
> This should probably be MFCed too.
> 
> MFC after:		2 weeks

Also, apologies to Ed Maste. Credit should go to emaste@ instead of ed@ 
(both listed as reviewers on D12785).


-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  http://www.FreeBSD.org

	The need of the many outweighs the greed of the few.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711031345.vA3DjAPC041708>