mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-14 16:26:17 +01:00
Don't pass more than G_MAXSSIZE bytes at once to write() in glib/gfileutils.c
Behaviour in that case is implementation-defined and how many bytes were actually written can't be expressed by the return value anymore. Instead do a short write of G_MAXSSIZE bytes and let the existing loop for handling short writes takes care of the remaining length.
This commit is contained in:
parent
856265fe66
commit
dae128e6bb
@ -1157,7 +1157,7 @@ write_to_file (const gchar *contents,
|
|||||||
{
|
{
|
||||||
gssize s;
|
gssize s;
|
||||||
|
|
||||||
s = write (fd, contents, length);
|
s = write (fd, contents, MIN (length, G_MAXSSIZE));
|
||||||
|
|
||||||
if (s < 0)
|
if (s < 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user