Commit Diff


commit - fe5469dab3da1d7d98ee24376b14f46a3ceffb58
commit + 83f1c89565efcc528df65f512b6166561565cb6c
blob - 730008089456427610cbcf2af03764555816083a
blob + 5c5c7cf05875817fdc1b947a823b54cfb5f34459
--- amused.1
+++ amused.1
@@ -203,6 +203,10 @@ or ones with a non-recognized audio format.
 The default format used by
 .Nm
 .Cm status .
+.It Ev TEMPDIR
+Path to the directory where the control socket is created.
+Defaults to
+.Pa /tmp .
 .El
 .Sh FILES
 .Bl -tag -width "/tmp/amused-UID" -compact
blob - 35aea2615072b1e68d1f572b0064c6e0d28f3e5b
blob + 0a8f16718e31d4a231defd850a2f730ea1c6505e
--- amused.c
+++ amused.c
@@ -344,9 +344,15 @@ main(int argc, char **argv)
 	if (proc == PROC_PLAYER)
 		exit(player(debug, verbose));
 
-	if (csock == NULL)
-		xasprintf(&csock, "/tmp/amused-%d", getuid());
+	if (csock == NULL) {
+		const char *tmpdir;
+
+		if ((tmpdir = getenv("TMPDIR")) == NULL)
+			tmpdir = "/tmp";
 
+		xasprintf(&csock, "%s/amused-%d", tmpdir, getuid());
+	}
+
 	if (argc > 0)
 		debug = 0;
 
blob - df59a054941dc954911b22103adf3992f24c5341
blob + 9283b84b27d4996efa9d89437a74b455e5942ab0
--- web/amused-web.1
+++ web/amused-web.1
@@ -46,6 +46,13 @@ is used.
 .It Fl v
 Produce more verbose output.
 .El
+.Sh ENVIRONMENT
+.Bl -tag -width tenletters
+.It Ev TEMPDIR
+Path to the directory where the control socket looked for.
+Defaults to
+.Pa /tmp .
+.El
 .Sh SEE ALSO
 .Xr amused 1
 .Sh AUTHORS
blob - dc49a48332163c02e48666d8e851d581aaadb2d5
blob + 305f4c7ce15a479e66f1e29ae430c56e1a5bd80f
--- web/web.c
+++ web/web.c
@@ -1048,9 +1048,15 @@ main(int argc, char **argv)
 
 	log_setverbose(verbose);
 
-	if (sock == NULL)
-		xasprintf(&sock, "/tmp/amused-%d", getuid());
+	if (sock == NULL) {
+		const char *tmpdir;
+
+		if ((tmpdir = getenv("TMPDIR")) == NULL)
+			tmpdir = "/tmp";
 
+		xasprintf(&sock, "%s/amused-%d", tmpdir, getuid());
+	}
+
 	signal(SIGPIPE, SIG_IGN);
 
 	if (ev_init() == -1)