dovecot-2.2: hostpid_init(): Don't waste memory from data stack.

dovecot at dovecot.org dovecot at dovecot.org
Fri Oct 12 01:17:23 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/a446d8bc2be5
changeset: 15202:a446d8bc2be5
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Oct 12 01:17:05 2012 +0300
description:
hostpid_init(): Don't waste memory from data stack.
Even though it's only a few bytes, it was being wasted permanently for all
processes.

diffstat:

 src/lib/hostpid.c |  3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diffs (13 lines):

diff -r d00cf8e0dae7 -r a446d8bc2be5 src/lib/hostpid.c
--- a/src/lib/hostpid.c	Fri Oct 12 01:06:13 2012 +0300
+++ b/src/lib/hostpid.c	Fri Oct 12 01:17:05 2012 +0300
@@ -28,8 +28,7 @@
 	/* allow calling hostpid_init() multiple times to reset hostname */
 	i_free_and_null(my_domain);
 
-	if (i_strocpy(pid, dec2str(getpid()), sizeof(pid)) < 0)
-		i_unreached();
+	i_snprintf(pid, sizeof(pid), "%lld", (long long)getpid());
 	my_pid = pid;
 }
 


More information about the dovecot-cvs mailing list