aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xentrace/xentrace.c
diff options
context:
space:
mode:
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2005-02-20 03:52:37 +0000
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2005-02-20 03:52:37 +0000
commit841d10cf2c15daf42a13e81d310db189815a3f4c (patch)
tree5286b153f86f95e5370e8d9420fae874f85f3216 /tools/xentrace/xentrace.c
parent3bef71ecbbd4477d46414d4c8a34daf948ab8bb2 (diff)
downloadxen-841d10cf2c15daf42a13e81d310db189815a3f4c.tar.gz
xen-841d10cf2c15daf42a13e81d310db189815a3f4c.tar.bz2
xen-841d10cf2c15daf42a13e81d310db189815a3f4c.zip
bitkeeper revision 1.1229 (42180985F67QALsnFjovJHWiIDEz_A)
Fix return-code checking in tools. Signed-off-by: Rik van Riel <riel@redhat.com> Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools/xentrace/xentrace.c')
-rw-r--r--tools/xentrace/xentrace.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c
index 351ecd71a8..2eaa1a1c25 100644
--- a/tools/xentrace/xentrace.c
+++ b/tools/xentrace/xentrace.c
@@ -77,8 +77,14 @@ struct timespec millis_to_timespec(unsigned long millis)
*/
void write_rec(unsigned int cpu, struct t_rec *rec, FILE *out)
{
- fwrite(&cpu, sizeof(cpu), 1, out);
- fwrite(rec, sizeof(*rec), 1, out);
+ size_t written = 0;
+ written += fwrite(&cpu, sizeof(cpu), 1, out);
+ written += fwrite(rec, sizeof(*rec), 1, out);
+ if ( written != 2 )
+ {
+ PERROR("Failed to write trace record");
+ exit(EXIT_FAILURE);
+ }
}
/**