mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-11-27 20:49:51 +01:00
Add g_close(), use it
There are two benefits to this: 1) We can centralize any operating system specific knowledge of close-vs-EINTR handling. For example, while on Linux we should never retry, if someone cared enough later about HP-UX, they could come by and change this one spot. 2) For places that do care about the return value and want to provide the caller with a GError, this function makes it convenient to do so. Note that gspawn.c had an incorrect EINTR loop-retry around close(). https://bugzilla.gnome.org/show_bug.cgi?id=682819
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "gdbusconnection.h"
|
||||
#include "gdbusintrospection.h"
|
||||
#include "gdbuserror.h"
|
||||
#include "glib/gstdio.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@@ -709,7 +710,7 @@ g_dbus_command_line_get_stdin (GApplicationCommandLine *cmdline)
|
||||
fds = g_unix_fd_list_steal_fds (fd_list, &n_fds);
|
||||
result = g_unix_input_stream_new (fds[0], TRUE);
|
||||
for (i = 1; i < n_fds; i++)
|
||||
close (fds[i]);
|
||||
(void) g_close (fds[i], NULL);
|
||||
g_free (fds);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user