[dovecot-cvs] dovecot/src/imap client.c,1.17,1.18 rawlog.c,1.7,1.8

cras at procontrol.fi cras at procontrol.fi
Thu Dec 19 03:02:37 EET 2002


Update of /home/cvs/dovecot/src/imap
In directory danu:/tmp/cvs-serv11467/imap

Modified Files:
	client.c rawlog.c 
Log Message:
Buffer related cleanups. Use PATH_MAX instead of hardcoded 1024 for paths.
Added str_path() and str_ppath() functions. i_snprintf() now returns only -1
or 0 depending on if buffer got full. dec2str() returns the string allocated
from data stack. Instead of just casting to (long) or (int), we now use
dec2str() with printf-like functions. Added o_stream_send_str(). Added
strocpy() and replaced all strcpy()s and strncpy()s with it.

Pretty much untested, hope it doesn't break too badly :)



Index: client.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/client.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- client.c	18 Dec 2002 15:15:41 -0000	1.17
+++ client.c	19 Dec 2002 01:02:35 -0000	1.18
@@ -120,7 +120,7 @@
 	if (client->output->closed)
 		return;
 
-	(void)o_stream_send(client->output, data, strlen(data));
+	(void)o_stream_send_str(client->output, data);
 	(void)o_stream_send(client->output, "\r\n", 2);
 }
 
@@ -134,9 +134,9 @@
 	if (tag == NULL || *tag == '\0')
 		tag = "*";
 
-	(void)o_stream_send(client->output, tag, strlen(tag));
+	(void)o_stream_send_str(client->output, tag);
 	(void)o_stream_send(client->output, " ", 1);
-	(void)o_stream_send(client->output, data, strlen(data));
+	(void)o_stream_send_str(client->output, data);
 	(void)o_stream_send(client->output, "\r\n", 2);
 }
 

Index: rawlog.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/rawlog.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- rawlog.c	12 Dec 2002 18:57:47 -0000	1.7
+++ rawlog.c	19 Dec 2002 01:02:35 -0000	1.8
@@ -116,14 +116,16 @@
 	if (strftime(timestamp, sizeof(timestamp), "%Y%m%d-%H%M%S", tm) <= 0)
 		i_fatal("strftime() failed");
 
-	fname = t_strdup_printf("%s/%s-%d.in", path, timestamp, (int)getpid());
+	fname = t_strdup_printf("%s/%s-%s.in", path, timestamp,
+				dec2str(getpid()));
 	log_in = open(fname, O_CREAT|O_EXCL|O_WRONLY, 0600);
 	if (log_in == -1) {
 		i_warning("rawlog_open: open() failed for %s: %m", fname);
 		return;
 	}
 
-	fname = t_strdup_printf("%s/%s-%d.out", path, timestamp, (int)getpid());
+	fname = t_strdup_printf("%s/%s-%s.out", path, timestamp,
+				dec2str(getpid()));
 	log_out = open(fname, O_CREAT|O_EXCL|O_WRONLY, 0600);
 	if (log_out == -1) {
 		i_warning("rawlog_open: open() failed for %s: %m", fname);
@@ -152,8 +154,8 @@
 	}
 	close(sfd[1]);
 
-	process_title_set(t_strdup_printf("[%s:%d rawlog]", getenv("USER"),
-					  (int)parent_pid));
+	process_title_set(t_strdup_printf("[%s:%s rawlog]", getenv("USER"),
+					  dec2str(parent_pid)));
 
 	/* child */
 	client_in = *hin;




More information about the dovecot-cvs mailing list