summaryrefslogtreecommitdiff
path: root/runtime/libprofile/CommonProfiling.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2011-10-20 21:10:27 +0000
committerDimitry Andric <dim@FreeBSD.org>2011-10-20 21:10:27 +0000
commit30815c536baacc07e925f0aef23a5395883173dc (patch)
tree2cbcf22585e99f8a87d12d5ff94f392c0d266819 /runtime/libprofile/CommonProfiling.c
parent411bd29eea3c360d5b48a18a17b5e87f5671af0e (diff)
Diffstat (limited to 'runtime/libprofile/CommonProfiling.c')
-rw-r--r--runtime/libprofile/CommonProfiling.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/runtime/libprofile/CommonProfiling.c b/runtime/libprofile/CommonProfiling.c
index 210a5e5ab78a..fbc1ef448518 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);