public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Sasha Levin <levinsasha928@gmail.com>
Cc: penberg@kernel.org, kvm@vger.kernel.org, mingo@elte.hu,
	asias.hejun@gmail.com
Subject: Re: [PATCH] kvm tools: Split custom rootfs init into two stages
Date: Mon, 5 Dec 2011 13:30:16 +0400	[thread overview]
Message-ID: <20111205093016.GP14515@moon> (raw)
In-Reply-To: <1323076931-4858-1-git-send-email-levinsasha928@gmail.com>

On Mon, Dec 05, 2011 at 11:22:11AM +0200, Sasha Levin wrote:
>  
> +static int kvm_custom_stage2(void)
> +{
> +	char tmp[PATH_MAX], dst[PATH_MAX], *src;
> +	const char *rootfs;
> +	int r;
> +
> +	src = realpath("guest/init_stage2", NULL);
> +	if (src == NULL)
> +		return -ENOMEM;
> +
> +	if (image_filename[0] == NULL)
> +		rootfs = "default";
> +	else
> +		rootfs = image_filename[0];
> +
> +	sprintf(tmp, "%s%s/virt/init_stage2", kvm__get_dir(), rootfs);
> +	remove(tmp);
> +
> +	sprintf(dst, "/host/%s", src);
> +	r = symlink(dst, tmp);
> +	free(src);
> +
> +	return r;
> +}
> +

I might be paranoid -- but could you please use snprintf here? :)

      reply	other threads:[~2011-12-05  9:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-05  9:22 [PATCH] kvm tools: Split custom rootfs init into two stages Sasha Levin
2011-12-05  9:30 ` Cyrill Gorcunov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111205093016.GP14515@moon \
    --to=gorcunov@gmail.com \
    --cc=asias.hejun@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=levinsasha928@gmail.com \
    --cc=mingo@elte.hu \
    --cc=penberg@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox