diff --git a/gio/gdbusauthmechanismsha1.c b/gio/gdbusauthmechanismsha1.c index 1ed1be6bd..453c36470 100644 --- a/gio/gdbusauthmechanismsha1.c +++ b/gio/gdbusauthmechanismsha1.c @@ -37,10 +37,6 @@ #include "gwin32sid.h" #endif -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#endif - #include "gdbusauthmechanismsha1.h" #include "gcredentials.h" #include "gdbuserror.h" diff --git a/gio/gdocumentportal.c b/gio/gdocumentportal.c index 8d181a526..57fbe4a37 100644 --- a/gio/gdocumentportal.c +++ b/gio/gdocumentportal.c @@ -33,12 +33,6 @@ #include "gunixfdlist.h" #endif -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#else -#define HAVE_O_CLOEXEC 1 -#endif - static gboolean get_document_portal (GXdpDocuments **documents, char **documents_mountpoint, @@ -167,9 +161,6 @@ g_document_portal_add_documents (GList *uris, } if (fd >= 0) { -#ifndef HAVE_O_CLOEXEC - fcntl (fd, F_SETFD, FD_CLOEXEC); -#endif idx = g_unix_fd_list_append (fd_list, fd, NULL); close (fd); } diff --git a/gio/glocalfile.c b/gio/glocalfile.c index 58af717cc..9c82eef10 100644 --- a/gio/glocalfile.c +++ b/gio/glocalfile.c @@ -51,10 +51,6 @@ #define O_BINARY 0 #endif -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#endif - #include "gfileattribute.h" #include "glocalfile.h" #include "glocalfileinfo.h" diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c index eea266813..04e25b771 100644 --- a/gio/glocalfileinfo.c +++ b/gio/glocalfileinfo.c @@ -92,10 +92,6 @@ #endif #endif -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#endif - #include "glocalfileinfo.h" #include "gioerror.h" #include "gthemedicon.h" diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c index fda643b50..14652bd56 100644 --- a/gio/glocalfileoutputstream.c +++ b/gio/glocalfileoutputstream.c @@ -65,12 +65,6 @@ #define O_BINARY 0 #endif -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#else -#define HAVE_O_CLOEXEC 1 -#endif - struct _GLocalFileOutputStreamPrivate { char *tmp_filename; char *original_filename; @@ -1315,10 +1309,6 @@ _g_local_file_output_stream_replace (const char *filename, set_error_from_open_errno (filename, error); return NULL; } -#if !defined(HAVE_O_CLOEXEC) && defined(F_SETFD) - else - fcntl (fd, F_SETFD, FD_CLOEXEC); -#endif stream = g_object_new (G_TYPE_LOCAL_FILE_OUTPUT_STREAM, NULL); stream->priv->fd = fd; diff --git a/gio/gopenuriportal.c b/gio/gopenuriportal.c index c0e2353ce..2017c604d 100644 --- a/gio/gopenuriportal.c +++ b/gio/gopenuriportal.c @@ -33,12 +33,6 @@ #include "gunixfdlist.h" #endif -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#else -#define HAVE_O_CLOEXEC 1 -#endif - gboolean g_openuri_portal_open_file (GFile *file, const char *parent_window, @@ -90,9 +84,6 @@ g_openuri_portal_open_file (GFile *file, return FALSE; } -#ifndef HAVE_O_CLOEXEC - fcntl (fd, F_SETFD, FD_CLOEXEC); -#endif fd_list = g_unix_fd_list_new_from_array (&fd, 1); fd = -1; fd_id = 0; @@ -363,9 +354,6 @@ g_openuri_portal_open_file_async (GFile *file, return; } -#ifndef HAVE_O_CLOEXEC - fcntl (fd, F_SETFD, FD_CLOEXEC); -#endif fd_list = g_unix_fd_list_new_from_array (&fd, 1); fd = -1; fd_id = 0; diff --git a/gio/gsubprocess.c b/gio/gsubprocess.c index dad32da83..7b2643b17 100644 --- a/gio/gsubprocess.c +++ b/gio/gsubprocess.c @@ -115,12 +115,6 @@ #define O_BINARY 0 #endif -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#else -#define HAVE_O_CLOEXEC 1 -#endif - #define COMMUNICATE_READ_SIZE 4096 /* A GSubprocess can have two possible states: running and not. @@ -235,10 +229,6 @@ unix_open_file (const char *filename, g_free (display_name); /* fall through... */ } -#ifndef HAVE_O_CLOEXEC - else - fcntl (my_fd, F_SETFD, FD_CLOEXEC); -#endif return my_fd; } diff --git a/gio/gtrashportal.c b/gio/gtrashportal.c index 82c1356c9..5d46d24d4 100644 --- a/gio/gtrashportal.c +++ b/gio/gtrashportal.c @@ -33,12 +33,6 @@ #include "gunixfdlist.h" #endif -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#else -#define HAVE_O_CLOEXEC 1 -#endif - #ifndef O_PATH #define O_PATH 0 #endif @@ -107,10 +101,6 @@ g_trash_portal_trash_file (GFile *file, goto out; } -#ifndef HAVE_O_CLOEXEC - fcntl (fd, F_SETFD, FD_CLOEXEC); -#endif - fd_list = g_unix_fd_list_new (); fd_in = g_unix_fd_list_append (fd_list, fd, error); g_close (fd, NULL); diff --git a/gio/kqueue/gkqueuefilemonitor.c b/gio/kqueue/gkqueuefilemonitor.c index b664753a1..e1d4a7b51 100644 --- a/gio/kqueue/gkqueuefilemonitor.c +++ b/gio/kqueue/gkqueuefilemonitor.c @@ -32,10 +32,6 @@ #include #include -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#endif - #include #include #include diff --git a/gio/tests/gsubprocess-testprog.c b/gio/tests/gsubprocess-testprog.c index b61ccc261..3b19227a8 100644 --- a/gio/tests/gsubprocess-testprog.c +++ b/gio/tests/gsubprocess-testprog.c @@ -124,12 +124,6 @@ sleep_forever_mode (int argc, return 0; } -#ifdef G_OS_UNIX -#define GLIB_FD_CLOEXEC "e" -#else -#define GLIB_FD_CLOEXEC "" -#endif - static int write_to_fds (int argc, char **argv) { @@ -138,7 +132,7 @@ write_to_fds (int argc, char **argv) for (i = 2; i < argc; i++) { int fd = atoi (argv[i]); - FILE *f = fdopen (fd, "w" GLIB_FD_CLOEXEC); + FILE *f = fdopen (fd, "we"); const char buf[] = "hello world\n"; size_t bytes_written; @@ -176,7 +170,7 @@ read_from_fd (int argc, char **argv) return 1; } - f = fdopen (fd, "r" GLIB_FD_CLOEXEC); + f = fdopen (fd, "re"); if (f == NULL) { g_warning ("Failed to open fd %d: %s", fd, g_strerror (errno)); diff --git a/glib/gfileutils.c b/glib/gfileutils.c index 472be651c..e177aaa7b 100644 --- a/glib/gfileutils.c +++ b/glib/gfileutils.c @@ -49,10 +49,6 @@ #define O_BINARY 0 #endif -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#endif - #include "gfileutils.h" #include "gstdio.h" diff --git a/glib/giounix.c b/glib/giounix.c index a5b8605de..41c6e27be 100644 --- a/glib/giounix.c +++ b/glib/giounix.c @@ -44,10 +44,6 @@ #include #include -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#endif - #include "giochannel.h" #include "gerror.h" diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c index f5b600b3a..0df69e806 100644 --- a/glib/gkeyfile.c +++ b/glib/gkeyfile.c @@ -53,10 +53,6 @@ #endif /* G_OS_WIN23 */ -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#endif - #include "gconvert.h" #include "gdataset.h" #include "gerror.h" diff --git a/glib/gmappedfile.c b/glib/gmappedfile.c index 222e05703..80e2e84a9 100644 --- a/glib/gmappedfile.c +++ b/glib/gmappedfile.c @@ -50,10 +50,6 @@ #endif -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#endif - #include "gconvert.h" #include "gerror.h" #include "gfileutils.h" diff --git a/glib/gspawn-posix.c b/glib/gspawn-posix.c index 8cbf8de1a..7a00667f4 100644 --- a/glib/gspawn-posix.c +++ b/glib/gspawn-posix.c @@ -111,12 +111,6 @@ extern char **environ; #endif -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#else -#define HAVE_O_CLOEXEC 1 -#endif - static gint g_execute (const gchar *file, gchar **argv, gchar **argv_buffer, @@ -1093,10 +1087,6 @@ do_posix_spawn (const gchar * const *argv, g_assert (read_null != -1); parent_close_fds[num_parent_close_fds++] = read_null; -#ifndef HAVE_O_CLOEXEC - fcntl (read_null, F_SETFD, FD_CLOEXEC); -#endif - r = posix_spawn_file_actions_adddup2 (&file_actions, read_null, 0); if (r != 0) goto out_close_fds; @@ -1117,10 +1107,6 @@ do_posix_spawn (const gchar * const *argv, g_assert (write_null != -1); parent_close_fds[num_parent_close_fds++] = write_null; -#ifndef HAVE_O_CLOEXEC - fcntl (write_null, F_SETFD, FD_CLOEXEC); -#endif - r = posix_spawn_file_actions_adddup2 (&file_actions, write_null, 1); if (r != 0) goto out_close_fds; @@ -1141,10 +1127,6 @@ do_posix_spawn (const gchar * const *argv, g_assert (write_null != -1); parent_close_fds[num_parent_close_fds++] = write_null; -#ifndef HAVE_O_CLOEXEC - fcntl (write_null, F_SETFD, FD_CLOEXEC); -#endif - r = posix_spawn_file_actions_adddup2 (&file_actions, write_null, 2); if (r != 0) goto out_close_fds; diff --git a/gmodule/gmodule.c b/gmodule/gmodule.c index a6804d3b3..5b370b706 100644 --- a/gmodule/gmodule.c +++ b/gmodule/gmodule.c @@ -51,10 +51,6 @@ #include /* For open() and close() prototypes. */ #endif -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#endif - #include "gmoduleconf.h" #include "gstdio.h"