提交 fb76151c 编写于 作者: J Jiri Denemark

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 <?xml ...?> declaration.

Requested by https://bugzilla.redhat.com/show_bug.cgi?id=602277
上级 b0ef5c53
......@@ -42,6 +42,7 @@ inet_pton
ioctl
maintainer-makefile
mkstemp
mkstemps
mktempd
netdb
perror
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册