Commit f77b11a0 authored by Juanma Barranquero's avatar Juanma Barranquero

* server.el, emacsclient.c: Use TMPDIR (default /tmp) instead of hardcoded /tmp.

parent f0e35aeb
2008-10-29 Ulrich Mueller <ulm@gentoo.org>
* emacsclient.c (set_local_socket): Use TMPDIR (default /tmp)
instead of hardcoded /tmp.
2008-10-13 Dan Nicolaescu <dann@ics.uci.edu>
* emacsclient.c (longopts, print_help_and_exit): Add -nw.
......
......@@ -1128,6 +1128,7 @@ set_local_socket ()
int default_sock = !socket_name;
int saved_errno = 0;
char *server_name = "server";
char *tmpdir;
if (socket_name && !index (socket_name, '/') && !index (socket_name, '\\'))
{ /* socket_name is a file name component. */
......@@ -1138,9 +1139,12 @@ set_local_socket ()
if (default_sock)
{
socket_name = alloca (100 + strlen (server_name));
sprintf (socket_name, "/tmp/emacs%d/%s",
(int) geteuid (), server_name);
tmpdir = egetenv ("TMPDIR");
if (!tmpdir)
tmpdir = "/tmp";
socket_name = alloca (32 + strlen (tmpdir) + strlen (server_name));
sprintf (socket_name, "%s/emacs%d/%s",
tmpdir, (int) geteuid (), server_name);
}
if (strlen (socket_name) < sizeof (server.sun_path))
......@@ -1174,9 +1178,10 @@ set_local_socket ()
if (pw && (pw->pw_uid != geteuid ()))
{
/* We're running under su, apparently. */
socket_name = alloca (100 + strlen (server_name));
sprintf (socket_name, "/tmp/emacs%d/%s",
(int) pw->pw_uid, server_name);
socket_name = alloca (32 + strlen (tmpdir)
+ strlen (server_name));
sprintf (socket_name, "%s/emacs%d/%s",
tmpdir, (int) pw->pw_uid, server_name);
if (strlen (socket_name) < sizeof (server.sun_path))
strcpy (server.sun_path, socket_name);
......
2008-10-29 Ulrich Mueller <ulm@gentoo.org>
* server.el (server-socket-dir): Use TMPDIR (default /tmp) instead
of hardcoded /tmp.
2008-10-29 Glenn Morris <rgm@gnu.org>
* net/xesam.el (dbus-get-unique-name, dbus-debug): Declare.
......
......@@ -202,7 +202,8 @@ are done with it in the server.")
(defvar server-name "server")
(defvar server-socket-dir (format "/tmp/emacs%d" (user-uid))
(defvar server-socket-dir
(format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid))
"The directory in which to place the server socket.")
(defun server-clients-with (property value)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment