diff lib-src/emacsclient.c @ 110833:5481007b7ce9

Close bug#3992. * lib-src/emacsclient.c (set_local_socket) [DARWIN_OS]: Try as a fall-back DARWIN_USER_TEMP_DIR.
author Glenn Morris <rgm@gnu.org>
date Thu, 30 Sep 2010 20:41:12 -0700
parents a3da62473e24
children bec49af30c2f 66622c9fb890
line wrap: on
line diff
--- a/lib-src/emacsclient.c	Fri Oct 01 01:05:26 2010 +0200
+++ b/lib-src/emacsclient.c	Thu Sep 30 20:41:12 2010 -0700
@@ -1249,7 +1249,18 @@
       {
 	tmpdir = egetenv ("TMPDIR");
 	if (!tmpdir)
-	  tmpdir = "/tmp";
+          {
+#ifdef DARWIN_OS
+            size_t n = confstr (_CS_DARWIN_USER_TEMP_DIR, NULL, (size_t) 0);
+            if (n > 0)
+              {
+                tmpdir = alloca (n);
+                confstr (_CS_DARWIN_USER_TEMP_DIR, tmpdir, n);
+              }
+            else
+#endif
+              tmpdir = "/tmp";
+          }
 	socket_name = alloca (strlen (tmpdir) + strlen (server_name)
 			      + EXTRA_SPACE);
 	sprintf (socket_name, "%s/emacs%d/%s",