dovecot-1.2: hostpid_init(): If called again, update the hostnam...

dovecot at dovecot.org dovecot at dovecot.org
Mon Aug 4 23:11:07 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/c832be51c7ac
changeset: 8065:c832be51c7ac
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Aug 04 15:49:40 2008 -0400
description:
hostpid_init(): If called again, update the hostname/pid.

diffstat:

1 file changed, 6 insertions(+), 11 deletions(-)
src/lib/hostpid.c |   17 ++++++-----------

diffs (26 lines):

diff -r 02c6ce8d4fef -r c832be51c7ac src/lib/hostpid.c
--- a/src/lib/hostpid.c	Mon Aug 04 15:48:18 2008 -0400
+++ b/src/lib/hostpid.c	Mon Aug 04 15:49:40 2008 -0400
@@ -12,16 +12,11 @@ void hostpid_init(void)
 {
 	static char hostname[256], pid[MAX_INT_STRLEN];
 
-	if (my_hostname == NULL) {
-		if (gethostname(hostname, sizeof(hostname)-1) == -1)
-			i_strocpy(hostname, "unknown", sizeof(hostname));
-		hostname[sizeof(hostname)-1] = '\0';
+	if (gethostname(hostname, sizeof(hostname)-1) == -1)
+		i_strocpy(hostname, "unknown", sizeof(hostname));
+	hostname[sizeof(hostname)-1] = '\0';
+	my_hostname = hostname;
 
-		my_hostname = hostname;
-	}
-
-	if (my_pid == NULL) {
-		i_strocpy(pid, dec2str(getpid()), sizeof(pid));
-		my_pid = pid;
-	}
+	i_strocpy(pid, dec2str(getpid()), sizeof(pid));
+	my_pid = pid;
 }


More information about the dovecot-cvs mailing list