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:
Sebastian Dröge 2020-08-27 17:42:28 +02:00
parent 856265fe66
commit dae128e6bb

View File

@ -1157,7 +1157,7 @@ write_to_file (const gchar *contents,
{
gssize s;
s = write (fd, contents, length);
s = write (fd, contents, MIN (length, G_MAXSSIZE));
if (s < 0)
{