mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 15:06:14 +01:00
glib: Pass O_CLOEXEC rather than FD_CLOEXEC to g_unix_open_pipe()
See the previous commit. Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
This commit is contained in:
parent
d0dc7171d6
commit
07c4b6c68e
@ -3188,7 +3188,7 @@ splice_stream_with_progress (GInputStream *in,
|
||||
fd_in = g_file_descriptor_based_get_fd (G_FILE_DESCRIPTOR_BASED (in));
|
||||
fd_out = g_file_descriptor_based_get_fd (G_FILE_DESCRIPTOR_BASED (out));
|
||||
|
||||
if (!g_unix_open_pipe (buffer, FD_CLOEXEC, error))
|
||||
if (!g_unix_open_pipe (buffer, O_CLOEXEC, error))
|
||||
return FALSE;
|
||||
|
||||
/* Try a 1MiB buffer for improved throughput. If that fails, use the default
|
||||
|
@ -604,7 +604,7 @@ make_pipe (gint pipe_fds[2],
|
||||
GError **error)
|
||||
{
|
||||
#if defined(G_OS_UNIX)
|
||||
return g_unix_open_pipe (pipe_fds, FD_CLOEXEC, error);
|
||||
return g_unix_open_pipe (pipe_fds, O_CLOEXEC, error);
|
||||
#elif defined(G_OS_WIN32)
|
||||
if (_pipe (pipe_fds, 4096, _O_BINARY) < 0)
|
||||
{
|
||||
|
@ -306,9 +306,9 @@ test_once (Fixture *f,
|
||||
GDBusMessage *message;
|
||||
gboolean pipe_res;
|
||||
|
||||
pipe_res = g_unix_open_pipe (f->server_to_client, FD_CLOEXEC, &f->error);
|
||||
pipe_res = g_unix_open_pipe (f->server_to_client, O_CLOEXEC, &f->error);
|
||||
g_assert (pipe_res);
|
||||
pipe_res = g_unix_open_pipe (f->client_to_server, FD_CLOEXEC, &f->error);
|
||||
pipe_res = g_unix_open_pipe (f->client_to_server, O_CLOEXEC, &f->error);
|
||||
g_assert (pipe_res);
|
||||
|
||||
f->server_iostream = my_io_stream_new_for_fds (f->client_to_server[0],
|
||||
|
@ -1750,9 +1750,9 @@ do_test_pass_fd (GSubprocessFlags flags,
|
||||
char *basic_fd_str;
|
||||
char *needdup_fd_str;
|
||||
|
||||
g_unix_open_pipe (basic_pipefds, FD_CLOEXEC, error);
|
||||
g_unix_open_pipe (basic_pipefds, O_CLOEXEC, error);
|
||||
g_assert_no_error (local_error);
|
||||
g_unix_open_pipe (needdup_pipefds, FD_CLOEXEC, error);
|
||||
g_unix_open_pipe (needdup_pipefds, O_CLOEXEC, error);
|
||||
g_assert_no_error (local_error);
|
||||
|
||||
basic_fd_str = g_strdup_printf ("%d", basic_pipefds[1]);
|
||||
@ -1854,10 +1854,10 @@ do_test_fd_conflation (GSubprocessFlags flags,
|
||||
return;
|
||||
}
|
||||
|
||||
g_unix_open_pipe (unused_pipefds, FD_CLOEXEC, &error);
|
||||
g_unix_open_pipe (unused_pipefds, O_CLOEXEC, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_unix_open_pipe (pipefds, FD_CLOEXEC, &error);
|
||||
g_unix_open_pipe (pipefds, O_CLOEXEC, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
/* The fds should be sequential since we are in a new process. */
|
||||
|
@ -63,7 +63,7 @@ test_fd_list (void)
|
||||
s = _pipe (sv, 4096, _O_NOINHERIT | _O_BINARY);
|
||||
g_assert_cmpint (s, ==, 0);
|
||||
#else
|
||||
g_unix_open_pipe (sv, FD_CLOEXEC, &err);
|
||||
g_unix_open_pipe (sv, O_CLOEXEC, &err);
|
||||
g_assert_no_error (err);
|
||||
#endif
|
||||
list = g_unix_fd_list_new_from_array (sv, -1);
|
||||
|
@ -305,7 +305,7 @@ launch_test_binary (const char *binary,
|
||||
gboolean loop_pending;
|
||||
gint i = 0;
|
||||
|
||||
if (!g_unix_open_pipe (report_pipe, FD_CLOEXEC, &error))
|
||||
if (!g_unix_open_pipe (report_pipe, O_CLOEXEC, &error))
|
||||
{
|
||||
if (subtest_mode_fatal)
|
||||
g_error ("Failed to open pipe for test binary: %s: %s", binary, error->message);
|
||||
|
@ -160,7 +160,7 @@ g_wakeup_new (void)
|
||||
/* for any failure, try a pipe instead */
|
||||
#endif
|
||||
|
||||
if (!g_unix_open_pipe (wakeup->fds, FD_CLOEXEC | O_NONBLOCK, &error))
|
||||
if (!g_unix_open_pipe (wakeup->fds, O_CLOEXEC | O_NONBLOCK, &error))
|
||||
g_error ("Creating pipes for GWakeup: %s", error->message);
|
||||
|
||||
if (!g_unix_set_fd_nonblocking (wakeup->fds[0], TRUE, &error) ||
|
||||
|
@ -237,7 +237,7 @@ test_spawn_async_with_fds (void)
|
||||
break;
|
||||
case PIPE:
|
||||
#ifdef G_OS_UNIX
|
||||
g_unix_open_pipe (test_pipe[j], FD_CLOEXEC, &error);
|
||||
g_unix_open_pipe (test_pipe[j], O_CLOEXEC, &error);
|
||||
g_assert_no_error (error);
|
||||
#else
|
||||
g_assert_cmpint (_pipe (test_pipe[j], 4096, _O_BINARY), >=, 0);
|
||||
|
@ -41,7 +41,7 @@ test_pipe (void)
|
||||
gssize bytes_read;
|
||||
gboolean res;
|
||||
|
||||
res = g_unix_open_pipe (pipefd, FD_CLOEXEC, &error);
|
||||
res = g_unix_open_pipe (pipefd, O_CLOEXEC, &error);
|
||||
g_assert (res);
|
||||
g_assert_no_error (error);
|
||||
|
||||
@ -103,7 +103,7 @@ test_pipe_stdio_overwrite (void)
|
||||
g_close (STDIN_FILENO, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
res = g_unix_open_pipe (pipefd, FD_CLOEXEC, &error);
|
||||
res = g_unix_open_pipe (pipefd, O_CLOEXEC, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert_true (res);
|
||||
|
||||
@ -143,7 +143,7 @@ test_nonblocking (void)
|
||||
gboolean res;
|
||||
int flags;
|
||||
|
||||
res = g_unix_open_pipe (pipefd, FD_CLOEXEC, &error);
|
||||
res = g_unix_open_pipe (pipefd, O_CLOEXEC, &error);
|
||||
g_assert (res);
|
||||
g_assert_no_error (error);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user