[ekg2-commit] ekg2: drafts.c (HEAD) [peres]

CVS commit cvs w toxygen.net
Nie, 6 Maj 2007, 23:55:23 CEST


Module name:	ekg2
Changes by:	peres	2007-05-06 23:55:20

Modified files:
	drafts.c

Log message:
Checking filesize after read, better reporting of truncated/expanded.

Index: drafts.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/jogger/drafts.c,v
diff -d -u -r1.14 -r1.15
--- drafts.c	6 May 2007 21:37:13 -0000	1.14
+++ drafts.c	6 May 2007 21:55:20 -0000	1.15
@@ -165,10 +165,20 @@
 		}
 
 		mylen = xstrlen(out);
-		if (rem > 0)
-			printq("io_truncated");
-		else if (fs > mylen)
-			printq("io_binaryfile", itoa(mylen));
+		{
+			struct stat st;
+
+			if (fstat(fd, &st) == -1)
+				debug_error("ekg_openfile(): unable to fstat() again!\n");
+			else if (st.st_size > fs)
+				printq("io_expanded");
+			else if (st.st_size < fs)
+				printq("io_truncated");
+			else if (rem > 0)
+				printq("io_truncated_read");
+			else if (fs > mylen)
+				printq("io_binaryfile", itoa(mylen));
+		}
 
 		if (len)
 			*len = mylen;


Więcej informacji o liście dyskusyjnej ekg2-commit