Making ts chdir to the socket directory. v0.6.3bis
authorviric@mandarina
Sun, 15 Feb 2009 21:28:08 +0100
changeset 263 0d831e6cf8ef
parent 262 b23c426568d3
child 264 d0ad4eadd619
Making ts chdir to the socket directory.
Changelog
main.c
server.c
--- a/Changelog	Sun Feb 15 19:12:32 2009 +0100
+++ b/Changelog	Sun Feb 15 21:28:08 2009 +0100
@@ -13,6 +13,8 @@
 v0.6.3:
  - Fixed a bug on -c and -t.
  - Adding first support for -D (run depending on any job)
+ - Adding version control on the protocol. It will work only from now on.
+ - Making the ts server chdir to the socket directory, so it doesn't annoy on umounting.
 v0.6.2:
  - Fixed a bug on -w
  - Making -S return the number of slots
--- a/main.c	Sun Feb 15 19:12:32 2009 +0100
+++ b/main.c	Sun Feb 15 21:28:08 2009 +0100
@@ -325,7 +325,7 @@
     printf("  -K       kill the task spooler server\n");
     printf("  -C       clear the list of finished jobs\n");
     printf("  -l       show the job list (default action)\n");
-    printf("  -S [num] get/set the number of max simultanious jobs of the server.\n");
+    printf("  -S [num] get/set the number of max simultaneous jobs of the server.\n");
     printf("  -t [id]  \"tail -n 10 -f\" the output of the job. Last run if not specified.\n");
     printf("  -c [id]  like -t, but shows all the lines. Last run if not specified.\n");
     printf("  -p [id]  show the pid of the job. Last run if not specified.\n");
--- a/server.c	Sun Feb 15 19:12:32 2009 +0100
+++ b/server.c	Sun Feb 15 21:28:08 2009 +0100
@@ -19,6 +19,7 @@
 #include <limits.h>
 #include <signal.h>
 #include <fcntl.h>
+#include <libgen.h>
 
 #include <stdio.h>
 
@@ -151,12 +152,18 @@
     int ls;
     struct sockaddr_un addr;
     int res;
+    char *dirpath;
 
     process_type = SERVER;
     max_descriptors = get_max_descriptors();
 
     path = _path;
 
+    /* Move the server to the socket directory */
+    dirpath = strdup(path);
+    chdir(dirname(dirpath));
+    free(dirpath);
+
     nconnections = 0;
 
     ls = socket(AF_UNIX, SOCK_STREAM, 0);