[evolution-ews] Dont close the file descriptor before reading the file content



commit 8089c8cfa44863f9d5437cbd3772324a95755731
Author: Or Goshen <orx goshen intel com>
Date:   Sun Jun 5 11:20:07 2011 +0300

    Dont close the file descriptor before reading the file content

 src/server/e-ews-connection.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index 5519cc8..37c091b 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -2778,11 +2778,12 @@ e_ews_connection_attach_file (ESoapMessage *msg,
 	}
 
 	buffer = malloc (st.st_size);
-	close (fd);
 	if (read (fd, buffer, st.st_size) != st.st_size) {
 		g_warning ("Error reading %u bytes from %s\n", (unsigned int)st.st_size, filepath);
+		close (fd);
 		return;
 	}
+	close (fd);
 
 	filename = strrchr (filepath, '/');
 	if (filename) filename++;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]