]> git.proxmox.com Git - qemu.git/commitdiff
qemu-ga: ga_open_pidfile(): use qemu_open()
authorLuiz Capitulino <lcapitulino@redhat.com>
Tue, 8 Jan 2013 21:26:25 +0000 (19:26 -0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 14 Jan 2013 18:00:20 +0000 (12:00 -0600)
This ensures that O_CLOEXEC is passed to open(), this way the
pid file fd is not leaked to executed processes.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Amos Kong <akong@redhat.com>
Tested-by: Amos Kong <akong@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qga/main.c

index a9b968c5070f0592acb03db0aa498c9dfdfad660..4239150d4e98bfb0c80f30193c1e3984e44930ab 100644 (file)
@@ -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) {