mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 11:56:16 +01:00
Merge branch 'issue_2883b' into 'main'
Use 'write' with 'count' <= max value of its return type Closes #2883 See merge request GNOME/glib!3200
This commit is contained in:
commit
f7a02efbb7
@ -1143,8 +1143,13 @@ write_to_file (const gchar *contents,
|
|||||||
{
|
{
|
||||||
gssize s;
|
gssize s;
|
||||||
|
|
||||||
s = write (fd, contents, MIN (length, G_MAXSIZE));
|
#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)
|
||||||
{
|
{
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
|
Loading…
Reference in New Issue
Block a user