diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2010-04-29 20:46:27 +0200 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2010-04-29 20:46:27 +0200 |
commit | 28efe765578c7bf75fea29c6d827b1925a0b3525 (patch) | |
tree | f660b79c2e0e9fe32255d58d1eff394c07e108c6 | |
parent | 064e3c024f388b36af5d39702cbf64e24613cb4f (diff) | |
download | fetchmail-28efe765578c7bf75fea29c6d827b1925a0b3525.tar.gz fetchmail-28efe765578c7bf75fea29c6d827b1925a0b3525.tar.bz2 fetchmail-28efe765578c7bf75fea29c6d827b1925a0b3525.zip |
Check fwrite return values, to silence linker warnings.
-rw-r--r-- | unmime.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -657,7 +657,7 @@ int outlevel = 0; #define BUFSIZE_INCREMENT 4096 #ifdef DEBUG -#define DBG_FWRITE(B,L,BS,FD) ((void)fwrite((B), (L), (BS), (FD))) +#define DBG_FWRITE(B,L,BS,FD) do { if (fwrite((B), (L), (BS), (FD))) { } } while(0) #else #define DBG_FWRITE(B,L,BS,FD) #endif @@ -720,8 +720,11 @@ int main(int argc, char *argv[]) bodytype = MimeBodyType(buffer, 1); i = strlen(buffer); - fwrite(buffer, i, 1, stdout); DBG_FWRITE(buffer, i, 1, fd_conv); + if (fwrite(buffer, i, 1, stdout) < 1) { + perror("fwrite"); + goto barf; + } do { buf_p = (buffer - 1); @@ -738,13 +741,17 @@ int main(int argc, char *argv[]) buf_p = buffer; UnMimeBodyline(&buf_p, 0, 0); } - fwrite(buffer, (buf_p - buffer), 1, stdout); DBG_FWRITE(buffer, (buf_p - buffer), 1, fd_conv); + if (fwrite(buffer, (buf_p - buffer), 1, stdout) < 1) { + perror("fwrite"); + goto barf; + } } } while (buf_p > buffer); +barf: free(buffer); - fflush(stdout); + if (EOF == fflush(stdout)) perror("fflush"); #ifdef DEBUG fclose(fd_orig); @@ -754,4 +761,3 @@ int main(int argc, char *argv[]) return 0; } #endif - |