
On 10/31/2012 03:42 PM, Eric Blake wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=871756
Commit cd1e8d1 assumed that systems new enough to have journald also have mkostemp; but this is not true for uclibc.
For that matter, use of mkstemp[s] is unsafe in a multi-threaded program. We should prefer mkostemp[s] in the first place.
* bootstrap.conf (gnulib_modules): Add mkostemp, mkostemps; drop mkstemp and mkstemps. * cfg.mk (sc_prohibit_mkstemp): New syntax check. * tools/virsh.c (vshEditWriteToTempFile): Adjust caller. * src/qemu/qemu_driver.c (qemuDomainScreenshot) (qemudDomainMemoryPeek): Likewise. * src/secret/secret_driver.c (replaceFile): Likewise. * src/vbox/vbox_tmpl.c (vboxDomainScreenshot): Likewise. --- bootstrap.conf | 4 ++-- cfg.mk | 6 ++++++ src/qemu/qemu_driver.c | 8 ++++---- src/secret/secret_driver.c | 4 ++-- src/vbox/vbox_tmpl.c | 4 ++-- tools/virsh.c | 2 +- 6 files changed, 17 insertions(+), 11 deletions(-)
[...]
diff --git a/tools/virsh.c b/tools/virsh.c index f0ec625..5388c9e 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -565,7 +565,7 @@ vshEditWriteToTempFile(vshControl *ctl, const char *doc) vshError(ctl, "%s", _("out of memory")); return NULL; } - fd = mkstemps(ret, 4); + fd = mkostemps(ret, 4, O_CLOEXEC); if (fd == -1) { vshError(ctl, _("mkstemps: failed to create temporary file: %s"),
This message should be changed as well.
virStrerror(errno, ebuf, sizeof(ebuf)));
ACK with that changed. Martin