From c764e0046efb4f318e3d80ae99c8f83c73fb8966 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Sat, 20 Oct 2007 11:31:14 +0100 Subject: [PATCH] make rtp socket/log dependent on hostname for nfs-mounted home Organization: Straylight/Edgeware From: Richard Kettlewell --- disobedience/rtp.c | 14 ++++++++++---- images/Makefile.am | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) 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 -- [mdw]