Revision 70e72ce4

b/osdep.c
235 235

  
236 236
    return qemu_pipe(fds);
237 237
}
238

  
239
/*
240
 * Creates a pipe with FD_CLOEXEC set on both file descriptors
241
 */
242
int qemu_pipe(int pipefd[2])
243
{
244
    int ret;
245

  
246
#ifdef CONFIG_PIPE2
247
    ret = pipe2(pipefd, O_CLOEXEC);
248
    if (ret != -1 || errno != ENOSYS) {
249
        return ret;
250
    }
251
#endif
252
    ret = pipe(pipefd);
253
    if (ret == 0) {
254
        qemu_set_cloexec(pipefd[0]);
255
        qemu_set_cloexec(pipefd[1]);
256
    }
257

  
258
    return ret;
259
}
260 238
#endif
261 239

  
262 240
/*
b/oslib-posix.c
87 87
    f = fcntl(fd, F_GETFD);
88 88
    fcntl(fd, F_SETFD, f | FD_CLOEXEC);
89 89
}
90

  
91
/*
92
 * Creates a pipe with FD_CLOEXEC set on both file descriptors
93
 */
94
int qemu_pipe(int pipefd[2])
95
{
96
    int ret;
97

  
98
#ifdef CONFIG_PIPE2
99
    ret = pipe2(pipefd, O_CLOEXEC);
100
    if (ret != -1 || errno != ENOSYS) {
101
        return ret;
102
    }
103
#endif
104
    ret = pipe(pipefd);
105
    if (ret == 0) {
106
        qemu_set_cloexec(pipefd[0]);
107
        qemu_set_cloexec(pipefd[1]);
108
    }
109

  
110
    return ret;
111
}

Also available in: Unified diff