]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Add .xml suffix to tmp files used in *edit commands
authorJiri Denemark <jdenemar@redhat.com>
Tue, 9 Nov 2010 09:27:09 +0000 (10:27 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 9 Nov 2010 12:42:54 +0000 (13:42 +0100)
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
tools/virsh.c

index 8f25554a3a2e962f043812a67e376601a58c9a77..12f64c8659c2093768ef7a88903d0b46e3a97426 100644 (file)
@@ -42,6 +42,7 @@ inet_pton
 ioctl
 maintainer-makefile
 mkstemp
+mkstemps
 mktempd
 netdb
 perror
index bc746f8cc54da3e4a8b800e11e680c207d15154e..26d7f5ac758c092705695c177bde99a9dfd62fba 100644 (file)
@@ -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;