[CRIU] [PATCH] stats: write stats at work directory

Ruslan Kuprieiev kupruser at gmail.com
Fri Nov 15 14:27:32 PST 2013


Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
 stats.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/stats.c b/stats.c
index baf52af..bd372ea 100644
--- a/stats.c
+++ b/stats.c
@@ -105,7 +105,7 @@ void write_stats(int what)
 	DumpStatsEntry ds_entry = DUMP_STATS_ENTRY__INIT;
 	RestoreStatsEntry rs_entry = RESTORE_STATS_ENTRY__INIT;
 	char *name;
-	int fd;
+	int fd, dfd;
 
 	pr_info("Writing stats\n");
 	if (what == DUMP_STATS) {
@@ -134,7 +134,13 @@ void write_stats(int what)
 	} else
 		return;
 
-	fd = open_image(CR_FD_STATS, O_DUMP, name);
+	dfd = open(".", O_RDONLY);
+	if (dfd < 0) {
+		pr_perror("Can't open cwd");
+		return;
+	}
+
+	fd = open_image_at(dfd, CR_FD_STATS, O_DUMP, name);
 	if (fd >= 0) {
 		pb_write_one(fd, &stats, PB_STATS);
 		close(fd);
-- 
1.8.1.2



More information about the CRIU mailing list