From 285540eaade048d744ac10015da7690737770c5e Mon Sep 17 00:00:00 2001 From: Galina Kistanova Date: Thu, 22 Sep 2011 17:33:24 +0000 Subject: Fix for warnings: ignoring return value of ‘write’, declared with attribute warn_unused_result. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit llvm-svn: 140314 --- llvm/runtime/libprofile/CommonProfiling.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'llvm/runtime/libprofile/CommonProfiling.c') 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); -- cgit v1.2.3