Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 340e01248478ba8b78a6d4d1809b1eff > files > 575

kvm-83-270.el5_11.src.rpm

From 4883c1e4c44bce37d8fe6547f9a4e5da4365302c Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@redhat.com>
Date: Fri, 10 Sep 2010 19:32:13 -0300
Subject: [PATCH 3/3] kvmtrace: check for ftruncate() errors

RH-Author: Eduardo Habkost <ehabkost@redhat.com>
Message-id: <1284147133-8755-4-git-send-email-ehabkost@redhat.com>
Patchwork-id: 11964
O-Subject: [RHEL5 qemu-kvm PATCH 3/3] kvmtrace: check for ftruncate() errors
Bugzilla: 632707
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>

A very unlikely error case, but it is better than ignoring the ftruncate()
return value.

Fixes this warning:

  kvmtrace.c:311: warning: ignoring return value of 'ftruncate', declared with attribute warn_unused_result

Bugzilla: 632707
Upstream status: not applicable: kvmtrace doesn't exist upstream anymore

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 user/kvmtrace.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 user/kvmtrace.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/user/kvmtrace.c b/user/kvmtrace.c
index de3c189..30543f8 100644
--- a/user/kvmtrace.c
+++ b/user/kvmtrace.c
@@ -308,7 +308,9 @@ static void tip_ftrunc_final(struct thread_information *tip)
 		if (tip->fs_buf)
 			munmap(tip->fs_buf, tip->fs_buf_len);
 
-		ftruncate(ofd, tip->fs_size);
+		if (ftruncate(ofd, tip->fs_size) < 0) {
+			fprintf(stderr, "warning: Thread %d failed to truncate %s\n", tip->cpu, tip->fn);
+		}
 	}
 }
 
-- 
1.6.5.5