$USER is no more used for crating the socket path. Now the UID is used.
authorviric@llimona
Tue, 10 Apr 2007 17:16:25 +0200
changeset 119 361b08d33762
parent 118 f45aad564b6e
child 120 790bc4cecd3b
$USER is no more used for crating the socket path. Now the UID is used.
Changelog
server_start.c
ts.1
--- a/Changelog	Tue Apr 10 00:16:04 2007 +0200
+++ b/Changelog	Tue Apr 10 17:16:25 2007 +0200
@@ -11,13 +11,13 @@
    the blocked process. It may complicate the user interface more than needed.
 
 v0.4:
- - Allow killing 'ts' in a nice way.
+ -* Allow killing 'ts' in a nice way.
    - It's good, because a spawner of 'ts' may want to kill it.
  - If the server is horribly killed (it may happen as this is software), store
    the task queue in a file, so it can be recovered.
  - Allow inspecting the environment for a command queued: env, pwd., together
    with other job queuing options (gzip, ...)
- - Store the 'times()' for the run tasks.
+ -* Store the 'times()' for the run tasks.
  - Use a better system than mkstemp() for finding output files, so we can add
    .gz to the gzipped outputs.
 v0.3.2:
--- a/server_start.c	Tue Apr 10 00:16:04 2007 +0200
+++ b/server_start.c	Tue Apr 10 17:16:25 2007 +0200
@@ -25,7 +25,7 @@
 static void create_path()
 {
     char *tmpdir;
-    char *username;
+    char userid[20];
     int size;
 
     /* As a priority, TS_SOCKET mandates over the path creation */
@@ -46,17 +46,15 @@
     if (tmpdir == NULL)
         tmpdir = "/tmp";
 
-    username = getenv("USER");
-    if (username == NULL)
-        username = "unknown";
+    sprintf(userid, "%u", (unsigned int) getuid());
 
     /* Calculate the size */
-    size = strlen(tmpdir) + strlen("/socket-ts.") + strlen(username) + 1;
+    size = strlen(tmpdir) + strlen("/socket-ts.") + strlen(userid) + 1;
 
     /* Freed after preparing the socket address */
     path = (char *) malloc(size);
 
-    sprintf(path, "%s/socket-ts.%s", tmpdir, username);
+    sprintf(path, "%s/socket-ts.%s", tmpdir, userid);
 }
 
 int try_connect(int s)
--- a/ts.1	Tue Apr 10 00:16:04 2007 +0200
+++ b/ts.1	Tue Apr 10 17:16:25 2007 +0200
@@ -162,12 +162,14 @@
 environment variable. This way, you can have a queue for your heavy disk
 operations, another for heavy use of ram., and have a simple script/alias
 wrapper over ts for those special queues. If it's not specified, it will be
-.B $TMPDIR/socket-ts.$USER.
+.B $TMPDIR/socket-ts.[uid].
 .TP
 .B "TS_MAILTO"
 Send the letters with job results to the address specified in this variable.
 Otherwise, they're sent to
-.B USER.
+.B $USER
+or if not defined,
+.B nobody.
 The system
 .B /usr/sbin/sendmail
 is used. The
@@ -177,10 +179,7 @@
 flags together.
 .TP
 .B "USER"
-As seen above, it's used for the socket name if
-.B TS_SOCKET
-is not defined, and
-also as the mail destination if
+As seen above, it's used for the mail destination if
 .B TS_MAILTO
 is not specified.
 .SH BUGS