From 1c34dc5138579c3c7855622ae0e0880c55c62f68 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 7 Aug 2002 18:30:32 +0000 Subject: Do slightly better error handling for close() and loop until it closes 2002-08-07 Jeffrey Stedfast * gal/util/e-xml-utils.c (e_xml_save_file): Do slightly better error handling for close() and loop until it closes successfully. svn path=/trunk/; revision=17733 --- e-util/e-xml-utils.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'e-util/e-xml-utils.c') diff --git a/e-util/e-xml-utils.c b/e-util/e-xml-utils.c index 6483b4122c..e8f6b0a1b9 100644 --- a/e-util/e-xml-utils.c +++ b/e-util/e-xml-utils.c @@ -699,8 +699,8 @@ e_xml_save_file (const char *filename, xmlDocPtr doc) size_t n, written = 0; xmlBufferPtr buf; int errnosave; + int ret, fd; ssize_t w; - int fd; filesave = alloca (strlen (filename) + 5); slash = strrchr (filename, '/'); @@ -742,9 +742,10 @@ e_xml_save_file (const char *filename, xmlDocPtr doc) return -1; } - close (fd); + while ((ret = close (fd)) == -1 && errno == EINTR) + ; - if (errno != 0) + if (ret == -1) return -1; if (rename (filesave, filename) == -1) { -- cgit v1.2.3