Description: Several fixes to the mail name file parsing.
 Fix a file descriptor leak in the MAILNAMEFILE code.
 Fix a mistake in my patch submitted to DFBSD - "initialized" should be static!

--- a/util.c
+++ b/util.c
@@ -47,8 +47,9 @@
 hostname(void)
 {
 	static char name[MAXHOSTNAMELEN+1];
-	int initialized = 0;
+	static int initialized = 0;
 	FILE *fp;
+	char *res;
 	size_t len;
 
 	if (initialized)
@@ -62,7 +63,9 @@
 	if (config.mailnamefile != NULL && config.mailnamefile[0] != '\0') {
 		fp = fopen(config.mailnamefile, "r");
 		if (fp != NULL) {
-			if (fgets(name, sizeof(name), fp) != NULL) {
+			res = fgets(name, sizeof(name), fp);
+			fclose(fp);
+			if (res != NULL) {
 				len = strlen(name);
 				while (len > 0 &&
 				    (name[len - 1] == '\r' ||
@@ -73,7 +76,6 @@
 					return (name);
 				}
 			}
-			fclose(fp);
 		}
 	}
 	if (gethostname(name, sizeof(name)) != 0)
