$OpenBSD: patch-src_editfns_c,v 1.2 2003/04/24 18:15:39 lebel Exp $
--- src/editfns.c.orig	Mon Mar 25 22:38:26 2002
+++ src/editfns.c	Mon Mar 25 22:41:42 2002
@@ -873,6 +873,7 @@ get_home_directory (void)
      between XEmacs and the outside world, the very moment we first get
      the data.  --ben */
   int output_home_warning = 0;
+  struct passwd *pw = NULL;
 
   if (cached_home_directory == NULL)
     {
@@ -919,6 +920,13 @@ get_home_directory (void)
 # endif
 	    }
 #else	/* !WIN32_NATIVE */
+	if ((pw = getpwuid(getuid())) != NULL)
+	  {
+	   cached_home_directory = pw->pw_dir;
+	   output_home_warning = 0;
+	  }
+	else
+	  {
 	  /*
 	   * Unix, typically.
 	   * Using "/" isn't quite right, but what should we do?
@@ -927,6 +935,7 @@ get_home_directory (void)
 	   */
 	  cached_home_directory = (Extbyte *) "/";
 	  output_home_warning = 1;
+	}
 #endif	/* !WIN32_NATIVE */
 	}
       if (initialized && output_home_warning)
