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 | 6bbba3cab48403f525af5df383462b343fd0d6ee (patch) | |
tree | 5efe4befe9b11d36ebb1a3c0d7d1a4d89f44e2c1 /runtime | |
parent | 4e414163594bdb156b1e9c4b64a886e7278ac871 (diff) | |
download | external_llvm-6bbba3cab48403f525af5df383462b343fd0d6ee.zip external_llvm-6bbba3cab48403f525af5df383462b343fd0d6ee.tar.gz external_llvm-6bbba3cab48403f525af5df383462b343fd0d6ee.tar.bz2 |
Fix for warnings: ignoring return value of ‘write’, declared with attribute warn_unused_result.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140314 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/libprofile/CommonProfiling.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/runtime/libprofile/CommonProfiling.c b/runtime/libprofile/CommonProfiling.c index 210a5e5..fbc1ef4 100644 --- a/runtime/libprofile/CommonProfiling.c +++ b/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); |