mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 18:52:09 +01:00
Merge branch 'backport-3200-write-limits-glib-2-74' into 'glib-2-74'
Backport !3200 “gfileutils: Use 'write' with 'count' <= max value of its return type” to glib-2-74 See merge request GNOME/glib!3204
This commit is contained in:
commit
78925535f9
@ -1143,7 +1143,13 @@ write_to_file (const gchar *contents,
|
|||||||
{
|
{
|
||||||
gssize s;
|
gssize s;
|
||||||
|
|
||||||
s = write (fd, contents, MIN (length, G_MAXSSIZE));
|
#ifdef G_OS_WIN32
|
||||||
|
/* 'write' on windows uses int types, so limit count to G_MAXINT */
|
||||||
|
s = write (fd, contents, MIN (length, (gsize) G_MAXINT));
|
||||||
|
#else
|
||||||
|
/* Limit count to G_MAXSSIZE to fit into the return value. */
|
||||||
|
s = write (fd, contents, MIN (length, (gsize) G_MAXSSIZE));
|
||||||
|
#endif
|
||||||
|
|
||||||
if (s < 0)
|
if (s < 0)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user