[glib/glib-2-64: 2/3] Don't pass more than G_MAXSSIZE bytes at once to write() in glib/gfileutils.c
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-64: 2/3] Don't pass more than G_MAXSSIZE bytes at once to write() in glib/gfileutils.c
- Date: Thu, 3 Sep 2020 09:33:47 +0000 (UTC)
commit 259903ca53e75c90956f3082792dc28a2cb2ad57
Author: Sebastian Dröge <sebastian centricular com>
Date: Thu Aug 27 17:42:28 2020 +0200
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.
glib/gfileutils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/glib/gfileutils.c b/glib/gfileutils.c
index acf57b3a1..d72f2d988 100644
--- a/glib/gfileutils.c
+++ b/glib/gfileutils.c
@@ -1089,7 +1089,7 @@ write_to_temp_file (const gchar *contents,
{
gssize s;
- s = write (fd, contents, length);
+ s = write (fd, contents, MIN (length, G_MAXSSIZE));
if (s < 0)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]