mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-06 05:02:29 +00:00
cleanup: Fix fread() and fwrite() error handling
Cleaned up some of the incorrect uses of fread() and fwrite(), mostly in the format modules. Neither of these functions will ever return a value less than 0, which we were checking for in some cases. I've introduced a fair amount of duplication in the format modules, but I plan to change how format modules work internally in a subsequent patch set, so this is simply a stop-gap. Change-Id: I8ca1cd47c20b2c0b72088bd13b9046f6977aa872
This commit is contained in:
@@ -6458,6 +6458,12 @@ static int get_input(struct mansession *s, char *output)
|
||||
}
|
||||
|
||||
ao2_lock(s->session);
|
||||
/*
|
||||
* It is worth noting here that you can all but ignore fread()'s documentation
|
||||
* for the purposes of this call. The FILE * we are working with here was created
|
||||
* as a result of a call to fopencookie() (or equivalent) in tcptls.c, and as such
|
||||
* the behavior of fread() is not as documented. Frankly, I think this is gross.
|
||||
*/
|
||||
res = fread(src + s->session->inlen, 1, maxlen - s->session->inlen, s->session->f);
|
||||
if (res < 1) {
|
||||
res = -1; /* error return */
|
||||
|
Reference in New Issue
Block a user