From d670683e1ebadd1d659634efd4ddcd878fb85cf8 Mon Sep 17 00:00:00 2001 From: Karl Heyes Date: Sun, 20 Nov 2005 13:53:29 +0000 Subject: [PATCH] allow for the intro file to change over HUP svn path=/icecast/trunk/icecast/; revision=10411 --- src/source.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/source.c b/src/source.c index f93feab0..7be2f6dd 100644 --- a/src/source.c +++ b/src/source.c @@ -1091,7 +1091,12 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo) else source->dumpfilename = NULL; - if (mountinfo && mountinfo->intro_filename && source->intro_file == NULL) + if (source->intro_file) + { + fclose (source->intro_file); + source->intro_file = NULL; + } + if (mountinfo && mountinfo->intro_filename) { ice_config_t *config = config_get_config_unlocked (); unsigned int len = strlen (config->webroot_dir) + @@ -1099,11 +1104,14 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo) char *path = malloc (len); if (path) { + FILE *f; snprintf (path, len, "%s" PATH_SEPARATOR "%s", config->webroot_dir, mountinfo->intro_filename); - source->intro_file = fopen (path, "rb"); - if (source->intro_file == NULL) + f = fopen (path, "rb"); + if (f) + source->intro_file = f; + else WARN2 ("Cannot open intro file \"%s\": %s", path, strerror(errno)); free (path); }