[libvirt] [PATCH] virsh: Add .xml suffix to tmp files used in *edit commands
Daniel P. Berrange
berrange at redhat.com
Tue Nov 9 11:48:38 UTC 2010
On Tue, Nov 09, 2010 at 12:27:00PM +0100, Jiri Denemark wrote:
> This helps editors with detecting the temporary files as XML since the
> temporary files do not contain <?xml ...?> declaration.
>
> Requested by https://bugzilla.redhat.com/show_bug.cgi?id=602277
> ---
> bootstrap.conf | 1 +
> tools/virsh.c | 6 +++---
> 2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/bootstrap.conf b/bootstrap.conf
> index 8f25554..12f64c8 100644
> --- a/bootstrap.conf
> +++ b/bootstrap.conf
> @@ -42,6 +42,7 @@ inet_pton
> ioctl
> maintainer-makefile
> mkstemp
> +mkstemps
> mktempd
> netdb
> perror
> diff --git a/tools/virsh.c b/tools/virsh.c
> index bc746f8..26d7f5a 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -8964,10 +8964,10 @@ editWriteToTempFile (vshControl *ctl, const char *doc)
>
> tmpdir = getenv ("TMPDIR");
> if (!tmpdir) tmpdir = "/tmp";
> - snprintf (ret, PATH_MAX, "%s/virshXXXXXX", tmpdir);
> - fd = mkstemp (ret);
> + snprintf (ret, PATH_MAX, "%s/virshXXXXXX.xml", tmpdir);
> + fd = mkstemps(ret, 4);
> if (fd == -1) {
> - vshError(ctl, _("mkstemp: failed to create temporary file: %s"),
> + vshError(ctl, _("mkstemps: failed to create temporary file: %s"),
> strerror(errno));
> VIR_FREE(ret);
> return NULL;
ACK
Regards,
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list