[Asterisk-code-review] cleanup: Fix fread() and fwrite() error handling (asterisk[13])

Sean Bright asteriskteam at digium.com
Tue Apr 25 16:02:16 CDT 2017


Sean Bright has posted comments on this change. ( https://gerrit.asterisk.org/5510 )

Change subject: cleanup: Fix fread() and fwrite() error handling
......................................................................


Patch Set 2:

(1 comment)

https://gerrit.asterisk.org/#/c/5510/2/apps/app_minivm.c
File apps/app_minivm.c:

PS2, Line 859: 	if ((l = fread(bio->iobuf, 1, B64_BASEMAXINLINE, fi)) != B64_BASEMAXINLINE) {
             : 		if (ferror(fi))
             : 			return -1;
             : 
             : 		bio->ateof = 1;
             : 		return 0;
             : 	}
> This function is rather stupid when handling short reads.
> This function is rather stupid when handling short reads.
 > 
 > Should be:
 > 
 > if ((l = fread(...)) != B64_BASEMAXINLINE) {
 > bio->ateof = 1;
 > if (l == 0) {
 > return 0;
 > }
 > }

How would this differentiate between EOF and a read error? Or do we not care?


-- 
To view, visit https://gerrit.asterisk.org/5510
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I8ca1cd47c20b2c0b72088bd13b9046f6977aa872
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list