From: Jiri Denemark Date: Tue, 9 Nov 2010 09:27:09 +0000 (+0100) Subject: virsh: Add .xml suffix to tmp files used in *edit commands X-Git-Tag: v0.8.6~148 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb76151c28df0fa07a35219ae7455cefd1c41199;p=thirdparty%2Flibvirt.git virsh: Add .xml suffix to tmp files used in *edit commands This helps editors with detecting the temporary files as XML since the temporary files do not contain declaration. Requested by https://bugzilla.redhat.com/show_bug.cgi?id=602277 --- diff --git a/bootstrap.conf b/bootstrap.conf index 8f25554a3a..12f64c8659 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 bc746f8cc5..26d7f5ac75 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;