From: Richard Kettlewell Date: Sat, 20 Oct 2007 10:31:14 +0000 (+0100) Subject: make rtp socket/log dependent on hostname for nfs-mounted home X-Git-Tag: debian-1_5_99dev8~105 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/c764e0046efb4f318e3d80ae99c8f83c73fb8966 make rtp socket/log dependent on hostname for nfs-mounted home --- diff --git a/disobedience/rtp.c b/disobedience/rtp.c index a4efed5..fa64ac3 100644 --- a/disobedience/rtp.c +++ b/disobedience/rtp.c @@ -26,6 +26,7 @@ #include #include #include +#include /** @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); } } diff --git a/images/Makefile.am b/images/Makefile.am index a8e4ddf..b346420 100644 --- a/images/Makefile.am +++ b/images/Makefile.am @@ -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