$OpenBSD: patch-src_editfns_c,v 1.2 2009/12/15 09:58:47 jasper Exp $
--- src/editfns.c.orig	Tue Aug 20 13:36:52 2002
+++ src/editfns.c	Tue Dec 15 10:58:32 2009
@@ -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)
