NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/57682: Check if suplied argument(s) has "-" using only argument vectors instead calling strcmp() function.



The following reply was made to PR bin/57682; it has been noted by GNATS.

From: Martin Husemann <martin%duskware.de@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/57682: Check if suplied argument(s) has "-" using only
 argument vectors instead calling strcmp() function.
Date: Sun, 5 Nov 2023 11:13:42 +0100

 On Sun, Nov 05, 2023 at 10:05:01AM +0000, nightquick%proton.me@localhost wrote:
 
 > -			if (!strcmp(*argv, "-"))
 > +			if (**argv == '-')
 >  				fp = stdin;
 
 This is wrong, you need to compare the full string (or check for it
 being only a single char long).
 
 
 >  			if (fstat(wfd, &sbuf) == 0 && sbuf.st_blksize > 0 &&
 >  			    (size_t)sbuf.st_blksize > sizeof(fb_buf))
 > -				bsize = sbuf.st_blksize;
 > +				bsize = (size_t)sbuf.st_blksize;
 
 This is OK (but I don't see the warning you are talking about).
 
 Martin
 


Home | Main Index | Thread Index | Old Index