chiark / gitweb /
make rtp socket/log dependent on hostname for nfs-mounted home
authorRichard Kettlewell <rjk@greenend.org.uk>
Sat, 20 Oct 2007 10:31:14 +0000 (11:31 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sat, 20 Oct 2007 10:31:14 +0000 (11:31 +0100)
disobedience/rtp.c
images/Makefile.am

index a4efed5c9b42fce6c1ee95262ffb237c4d51396d..fa64ac3a164856d32c57bc50eea831b4d9be0c69 100644 (file)
@@ -26,6 +26,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/un.h>
+#include <sys/utsname.h>
 
 /** @brief Path to RTP player's control socket */
 static char *rtp_socket;
@@ -37,12 +38,17 @@ static char *rtp_log;
 static void rtp_init(void) {
   if(!rtp_socket) {
     const char *home = getenv("HOME");
-    char *dir;
+    char *dir, *base;
+    struct utsname uts;
 
-    byte_xasprintf(&dir, "%s/.disorder", home);
+    byte_xasprintf(&dir, "%s/.disorder/", home);
     mkdir(dir, 02700);
-    byte_xasprintf(&rtp_socket, "%s/rtp", dir);
-    byte_xasprintf(&rtp_log, "%s/rtp.log", dir);
+    if(uname(&uts) < 0)
+      byte_xasprintf(&base, "%s/", dir);
+    else
+      byte_xasprintf(&base, "%s/%s-", dir, uts.nodename);
+    byte_xasprintf(&rtp_socket, "%srtp", base);
+    byte_xasprintf(&rtp_log, "%srtp.log", base);
   }
 }
 
index a8e4ddf0f84cc88db8c711c6c2758c0152a58369..b34642039d9e241e2b88147298a77e6f5254cf2d 100644 (file)
@@ -1,6 +1,6 @@
 #
 # This file is part of DisOrder.
-# Copyright (C) 2005, 2006 Richard Kettlewell
+# Copyright (C) 2005, 2006, 2007 Richard Kettlewell
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by