mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-23 15:49:16 +02:00
Merge branch 'wip/pwithnall/bsd-nofollow' into 'master'
gfileutils: Fix O_NOFOLLOW handling on BSD systems See merge request GNOME/glib!1591
This commit is contained in:
commit
4bd74ac582
@ -1444,12 +1444,23 @@ consistent_out:
|
|||||||
/* ELOOP indicates that @filename is a symlink, since we used
|
/* ELOOP indicates that @filename is a symlink, since we used
|
||||||
* O_NOFOLLOW (alternately it could indicate that @filename contains
|
* O_NOFOLLOW (alternately it could indicate that @filename contains
|
||||||
* looping or too many symlinks). In either case, try again on the
|
* looping or too many symlinks). In either case, try again on the
|
||||||
* %G_FILE_SET_CONTENTS_CONSISTENT code path. */
|
* %G_FILE_SET_CONTENTS_CONSISTENT code path.
|
||||||
|
*
|
||||||
|
* FreeBSD uses EMLINK instead of ELOOP
|
||||||
|
* (https://www.freebsd.org/cgi/man.cgi?query=open&sektion=2#STANDARDS),
|
||||||
|
* and NetBSD uses EFTYPE
|
||||||
|
* (https://netbsd.gw.com/cgi-bin/man-cgi?open+2+NetBSD-current). */
|
||||||
|
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
||||||
|
if (saved_errno == EMLINK)
|
||||||
|
#elif defined(__NetBSD__)
|
||||||
|
if (saved_errno == EFTYPE)
|
||||||
|
#else
|
||||||
if (saved_errno == ELOOP)
|
if (saved_errno == ELOOP)
|
||||||
|
#endif
|
||||||
return g_file_set_contents_full (filename, contents, length,
|
return g_file_set_contents_full (filename, contents, length,
|
||||||
flags | G_FILE_SET_CONTENTS_CONSISTENT,
|
flags | G_FILE_SET_CONTENTS_CONSISTENT,
|
||||||
mode, error);
|
mode, error);
|
||||||
#endif
|
#endif /* O_NOFOLLOW */
|
||||||
|
|
||||||
set_file_error (error,
|
set_file_error (error,
|
||||||
filename, _("Failed to open file “%s”: %s"),
|
filename, _("Failed to open file “%s”: %s"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user