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

dovecot at dovecot.org dovecot at dovecot.org
Mon Aug 4 23:10:56 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/d8597e1bbbb8
changeset: 7807:d8597e1bbbb8
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 0b1047dab36b -r d8597e1bbbb8 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