util: replace pipe()+cloexec with g_unix_open_pipe()
Suggested-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
a7241974ce
commit
81badab381
@ -60,14 +60,11 @@ static int qemu_signalfd_compat(const sigset_t *mask)
|
|||||||
|
|
||||||
info = g_malloc(sizeof(*info));
|
info = g_malloc(sizeof(*info));
|
||||||
|
|
||||||
if (pipe(fds) == -1) {
|
if (!g_unix_open_pipe(fds, FD_CLOEXEC, NULL)) {
|
||||||
g_free(info);
|
g_free(info);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
qemu_set_cloexec(fds[0]);
|
|
||||||
qemu_set_cloexec(fds[1]);
|
|
||||||
|
|
||||||
memcpy(&info->mask, mask, sizeof(*mask));
|
memcpy(&info->mask, mask, sizeof(*mask));
|
||||||
info->fd = fds[1];
|
info->fd = fds[1];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user