提交 6ffacc5d 编写于 作者: L Luiz Capitulino 提交者: Michael Roth

qemu-ga: ga_open_pidfile(): use qemu_open()

This ensures that O_CLOEXEC is passed to open(), this way the
pid file fd is not leaked to executed processes.
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Acked-by: NAmos Kong <akong@redhat.com>
Tested-by: NAmos Kong <akong@redhat.com>
Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
上级 a507db95
......@@ -267,7 +267,7 @@ static bool ga_open_pidfile(const char *pidfile)
int pidfd;
char pidstr[32];
pidfd = open(pidfile, O_CREAT|O_WRONLY, S_IRUSR|S_IWUSR);
pidfd = qemu_open(pidfile, O_CREAT|O_WRONLY, S_IRUSR|S_IWUSR);
if (pidfd == -1 || lockf(pidfd, F_TLOCK, 0)) {
g_critical("Cannot lock pid file, %s", strerror(errno));
if (pidfd != -1) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册