From 6bbba3cab48403f525af5df383462b343fd0d6ee Mon Sep 17 00:00:00 2001 From: Galina Kistanova Date: Thu, 22 Sep 2011 17:33:24 +0000 Subject: [PATCH] =?utf8?q?Fix=20for=20warnings:=20ignoring=20return=20valu?= =?utf8?q?e=20of=20=E2=80=98write=E2=80=99,=20declared=20with=20attribute?= =?utf8?q?=20warn=5Funused=5Fresult.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140314 91177308-0d34-0410-b5e6-96231b3b80d8 --- runtime/libprofile/CommonProfiling.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/runtime/libprofile/CommonProfiling.c b/runtime/libprofile/CommonProfiling.c index 210a5e5ab78..fbc1ef44851 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); -- 2.34.1