[CRIU] [PATCH] kerndat:fix compile err
zhanghonghui at huawei.com
zhanghonghui at huawei.com
Tue Apr 16 04:39:43 EDT 2013
From: Libo Chen <libo.chen at huawei.com>
Update to commit 78b8abe9a53884686d4f70d1376f85108cbfc857
I find a compile err:
kerndat.c: In function 'kerndat_get_dirty_track':
kerndat.c:78:6: error: ignoring return value of 'read', declared with attribute warn_unused_result [-Werror=unused-result]
cc1: all warnings being treated as errors
make[2]: *** [kerndat.o] Error 1
make[1]: *** [built-in.o] Error 2
make[1]: Leaving directory `/home/clb/crtools'
make: *** [all] Error 2
Signed-off-by: Libo Chen <libo.chen at huawei.com>
---
kerndat.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/kerndat.c b/kerndat.c
index e9e243d..90263a9 100644
--- a/kerndat.c
+++ b/kerndat.c
@@ -58,12 +58,13 @@ int kerndat_get_dirty_track(void)
char *map;
int pm2;
u64 pmap = 0;
+ int ret = -1;
map = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (map == MAP_FAILED) {
pr_perror("Can't mmap piggie2");
- return -1;
+ return ret;
}
map[0] = '\0';
@@ -71,11 +72,15 @@ int kerndat_get_dirty_track(void)
pm2 = open("/proc/self/pagemap2", O_RDONLY);
if (pm2 < 0) {
pr_perror("Can't open pagemap2 file");
- return -1;
+ return ret;
}
lseek(pm2, (unsigned long)map / PAGE_SIZE * sizeof(u64), SEEK_SET);
- read(pm2, &pmap, sizeof(pmap));
+ ret = read(pm2, &pmap, sizeof(pmap));
+ if (ret < 0){
+ pr_perror("Read pmap err!");
+ }
+
close(pm2);
munmap(map, PAGE_SIZE);
--
1.7.10.4
More information about the CRIU
mailing list