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

Ruslan Kuprieiev kupruser at gmail.com
Fri Nov 15 14:29:05 PST 2013


On 16.11.2013 02:27, Ruslan Kuprieiev wrote:
> 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);
Oh, wait, i forgot to close dir.


More information about the CRIU mailing list