mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 07:23:41 +02: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:
@@ -33,6 +33,9 @@
|
||||
|
||||
#include "gcontenttypeprivate.h"
|
||||
#include "gdesktopappinfo.h"
|
||||
#ifdef G_OS_UNIX
|
||||
#include "glib-unix.h"
|
||||
#endif
|
||||
#include "gfile.h"
|
||||
#include "gioerror.h"
|
||||
#include "gthemedicon.h"
|
||||
@@ -2100,7 +2103,8 @@ g_desktop_app_info_ensure_saved (GDesktopAppInfo *info,
|
||||
|
||||
desktop_id = g_path_get_basename (filename);
|
||||
|
||||
close (fd);
|
||||
/* FIXME - actually handle error */
|
||||
(void) g_close (fd, NULL);
|
||||
|
||||
res = g_file_set_contents (filename, data, data_size, error);
|
||||
g_free (data);
|
||||
|
Reference in New Issue
Block a user