view src/lib/hostpid.c @ 6429:65c69a53a7be HEAD

Replaced my Copyright notices. The year range always ends with 2007 now. My name was replaced with "Dovecot authors". In many cases I didn't really even own the copyright, so this is more correct.
author Timo Sirainen <tss@iki.fi>
date Sun, 16 Sep 2007 14:34:22 +0300
parents 18173a52f721
children 7ed926ed7aa4
line wrap: on
line source

/* Copyright (c) 2002-2007 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "hostpid.h"

#include <unistd.h>

const char *my_hostname = NULL;
const char *my_pid = NULL;

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';

		my_hostname = hostname;
	}

	if (my_pid == NULL) {
		i_strocpy(pid, dec2str(getpid()), sizeof(pid));
		my_pid = pid;
	}
}