]> Git Repo - qemu.git/commitdiff
compatfd.c: Don't pass NULL pointer to SYS_signalfd
authorPeter Maydell <[email protected]>
Thu, 13 Oct 2011 17:45:37 +0000 (18:45 +0100)
committerAndrzej Zaborowski <[email protected]>
Fri, 21 Oct 2011 16:01:35 +0000 (18:01 +0200)
Don't pass a NULL pointer in to SYS_signalfd in qemu_signalfd_available():
this isn't valid and Valgrind complains about it.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Andrzej Zaborowski <[email protected]>
compatfd.c

index 31654c62a690aff68d7350bbe96ed80391e36b7a..02306a4f71ea5b32b88b1468084a621a2012fba0 100644 (file)
@@ -119,9 +119,17 @@ int qemu_signalfd(const sigset_t *mask)
 bool qemu_signalfd_available(void)
 {
 #ifdef CONFIG_SIGNALFD
+    sigset_t mask;
+    int fd;
+    bool ok;
+    sigemptyset(&mask);
     errno = 0;
-    syscall(SYS_signalfd, -1, NULL, _NSIG / 8);
-    return errno != ENOSYS;
+    fd = syscall(SYS_signalfd, -1, &mask, _NSIG / 8);
+    ok = (errno != ENOSYS);
+    if (fd >= 0) {
+        close(fd);
+    }
+    return ok;
 #else
     return false;
 #endif
This page took 0.02608 seconds and 4 git commands to generate.