diff options
| author | Galina Kistanova <gkistanova@gmail.com> | 2011-09-22 17:33:24 +0000 |
|---|---|---|
| committer | Galina Kistanova <gkistanova@gmail.com> | 2011-09-22 17:33:24 +0000 |
| commit | 285540eaade048d744ac10015da7690737770c5e (patch) | |
| tree | 6fb3472fe793a19df6b1d803d3e2b77dca20d6bf /llvm | |
| parent | cf9c4f80ba8405f6b857b881fbd81b45fbf9d165 (diff) | |
| download | bcm5719-llvm-285540eaade048d744ac10015da7690737770c5e.tar.gz bcm5719-llvm-285540eaade048d744ac10015da7690737770c5e.zip | |
Fix for warnings: ignoring return value of ‘write’, declared with attribute warn_unused_result.
llvm-svn: 140314
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/runtime/libprofile/CommonProfiling.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/llvm/runtime/libprofile/CommonProfiling.c b/llvm/runtime/libprofile/CommonProfiling.c index 210a5e5ab78..fbc1ef44851 100644 --- a/llvm/runtime/libprofile/CommonProfiling.c +++ b/llvm/runtime/libprofile/CommonProfiling.c @@ -102,12 +102,19 @@ int getOutFile() { { int PTy = ArgumentInfo; int Zeros = 0; - write(OutFile, &PTy, sizeof(int)); - write(OutFile, &SavedArgsLength, sizeof(unsigned)); - write(OutFile, SavedArgs, SavedArgsLength); + if (write(OutFile, &PTy, sizeof(int)) < 0 || + write(OutFile, &SavedArgsLength, sizeof(unsigned)) < 0 || + write(OutFile, SavedArgs, SavedArgsLength) < 0 ) { + fprintf(stderr,"error: unable to write to output file."); + exit(0); + } /* Pad out to a multiple of four bytes */ - if (SavedArgsLength & 3) - write(OutFile, &Zeros, 4-(SavedArgsLength&3)); + if (SavedArgsLength & 3) { + if (write(OutFile, &Zeros, 4-(SavedArgsLength&3)) < 0) { + fprintf(stderr,"error: unable to write to output file."); + exit(0); + } + } } } return(OutFile); |

