[llvm-commits] [llvm] r140314 - /llvm/trunk/runtime/libprofile/CommonProfiling.c
Galina Kistanova
gkistanova at gmail.com
Thu Sep 22 10:33:24 PDT 2011
Author: gkistanova
Date: Thu Sep 22 12:33:24 2011
New Revision: 140314
URL: http://llvm.org/viewvc/llvm-project?rev=140314&view=rev
Log:
Fix for warnings: ignoring return value of ‘write’, declared with attribute warn_unused_result.
Modified:
llvm/trunk/runtime/libprofile/CommonProfiling.c
Modified: llvm/trunk/runtime/libprofile/CommonProfiling.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/runtime/libprofile/CommonProfiling.c?rev=140314&r1=140313&r2=140314&view=diff
==============================================================================
--- llvm/trunk/runtime/libprofile/CommonProfiling.c (original)
+++ llvm/trunk/runtime/libprofile/CommonProfiling.c Thu Sep 22 12:33:24 2011
@@ -102,12 +102,19 @@
{
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);
More information about the llvm-commits
mailing list