aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_http_post.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-02 18:52:13 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-02 18:52:13 +0000
commitcc1b2c100fc6dd44a690652ecd3c5788b0438ea7 (patch)
treea3750d996d41e35c5df34c29533dd7d9fdcaff24 /res/res_http_post.c
parent2d6e969e7c81afb0b050691b85f2bc74ca84ae62 (diff)
bring over all the fixes for the warnings found by gcc 4.3.x from the 1.4 branch, and add the ones needed for all the new code here too
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@153616 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_http_post.c')
-rw-r--r--res/res_http_post.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/res/res_http_post.c b/res/res_http_post.c
index 28a78e60a..8450fb7eb 100644
--- a/res/res_http_post.c
+++ b/res/res_http_post.c
@@ -215,8 +215,11 @@ static int readmimefile(FILE * fin, FILE * fout, char * boundary, int contentlen
num_to_read = contentlen;
}
- if(0 < num_to_read) {
- fread(&(buf[char_in_buf]), 1, num_to_read, fin);
+ if (0 < num_to_read) {
+ if (fread(&(buf[char_in_buf]), 1, num_to_read, fin) < num_to_read) {
+ ast_log(LOG_WARNING, "fread() failed: %s\n", strerror(errno));
+ num_to_read = 0;
+ }
contentlen -= num_to_read;
char_in_buf += num_to_read;
}
@@ -241,9 +244,13 @@ static int readmimefile(FILE * fin, FILE * fout, char * boundary, int contentlen
}
}
if (filespec) { /* If the file name path was found in the header */
- fwrite(buf, 1, marker, fout);
+ if (fwrite(buf, 1, marker, fout) != marker) {
+ ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
+ }
x = (int)(path_end+1 - filespec);
- fwrite(filespec, 1, x, fout);
+ if (fwrite(filespec, 1, x, fout) != x) {
+ ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
+ }
x = (int)(path_end+1 - buf);
memmove(buf, &(buf[x]), char_in_buf-x);
char_in_buf -= x;
@@ -254,18 +261,24 @@ static int readmimefile(FILE * fin, FILE * fout, char * boundary, int contentlen
if (0 > marker) {
if (char_in_buf < (boundary_len)) {
/*no possibility to find the boundary, write all you have */
- fwrite(buf, 1, char_in_buf, fout);
+ if (fwrite(buf, 1, char_in_buf, fout) != char_in_buf) {
+ ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
+ }
char_in_buf = 0;
} else {
/* write all except for area where the boundary marker could be */
- fwrite(buf, 1, char_in_buf -(boundary_len -1), fout);
+ if (fwrite(buf, 1, char_in_buf -(boundary_len -1), fout) != char_in_buf - (boundary_len - 1)) {
+ ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
+ }
x = char_in_buf -(boundary_len -1);
memmove(buf, &(buf[x]), char_in_buf-x);
char_in_buf = (boundary_len -1);
}
} else {
/* write up through the boundary, then look for filename in the rest */
- fwrite(buf, 1, marker + boundary_len, fout);
+ if (fwrite(buf, 1, marker + boundary_len, fout) != marker + boundary_len) {
+ ast_log(LOG_WARNING, "fwrite() failed: %s\n", strerror(errno));
+ }
x = marker + boundary_len;
memmove(buf, &(buf[x]), char_in_buf-x);
char_in_buf -= marker + boundary_len;