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

CVS commit cvs w toxygen.net
Pon, 7 Maj 2007, 01:11:43 CEST


Module name:	ekg2
Changes by:	peres	2007-05-07 01:11:41

Modified files:
	xmsg.c

Log message:
Temporary workaround for mmap() with (fs % getpagesize() == 0) problem.
XXX: move on to ekg_openfile().

Index: xmsg.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/xmsg/xmsg.c,v
diff -d -u -r1.24 -r1.25
--- xmsg.c	1 May 2007 22:59:59 -0000	1.24
+++ xmsg.c	6 May 2007 23:11:40 -0000	1.25
@@ -326,7 +326,7 @@
 		return -1; /* we don't want to unlink such files */
 	} else if (fs == 0)
 		xdebug("empty file found, not submitting");
-	else {
+	else { /* XXX: move on to ekg_openfile() */
 		fd = open(f, O_RDONLY);
 		if (fd < 0)
 			xerrn("unable to open given file");
@@ -350,9 +350,13 @@
 
 			{
 				const char *charset = session_get(s, "charset");
+				char *tmp = xstrndup(msg, fs); /* temporary workaround for mmap() problems */
 
-				if (charset)
-					msgx = ekg_convert_string(msg, charset, NULL);
+				if (charset) {
+					msgx = ekg_convert_string(tmp, charset, NULL);
+					xfree(tmp);
+				} else
+					msgx = tmp;
 			}
 
 			xstrcpy(uid, "xmsg:");
@@ -369,7 +373,7 @@
 					*q = '\0';
 			}
 
-			query_emit_id(NULL, PROTOCOL_MESSAGE, &session, &uid, &rcpts, (msgx ? &msgx : &msg), &format, &sent, &class, &seq, &dobeep, &secure);
+			query_emit_id(NULL, PROTOCOL_MESSAGE, &session, &uid, &rcpts, &msgx, &format, &sent, &class, &seq, &dobeep, &secure);
 
 			xfree(msgx);
 			xfree(uid);


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