diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2020-08-27 17:42:28 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2020-08-27 19:32:14 +0300 |
commit | dae128e6bb83f27605430b5b5661ba331d102926 (patch) | |
tree | 756adb0c09f4020a4c1fb89a97cba96461cdd2b8 | |
parent | 856265fe669be15cfd156b720cc6614c4ae4f7a5 (diff) | |
download | glib-dae128e6bb83f27605430b5b5661ba331d102926.tar.gz |
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.
-rw-r--r-- | glib/gfileutils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/glib/gfileutils.c b/glib/gfileutils.c index 8992203d6..46f200ddf 100644 --- a/glib/gfileutils.c +++ b/glib/gfileutils.c @@ -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) { |