mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-01-03 14:56:34 -05:00
Allow (standard strftime(3)) %x codes in mount's <dump-file> to embedd timestamps in filenames. This currently only works on non windows. closes #1823
svn path=/icecast/trunk/icecast/; revision=18455
This commit is contained in:
parent
2cb0e3180d
commit
9967447544
25
src/source.c
25
src/source.c
@ -579,6 +579,29 @@ static void send_to_listener (source_t *source, client_t *client, int deletion_e
|
||||
}
|
||||
|
||||
|
||||
/* Open the file for stream dumping.
|
||||
* This function should do all processing of the filename.
|
||||
*/
|
||||
static FILE * source_open_dumpfile(const char * filename) {
|
||||
#ifndef _WIN32
|
||||
/* some of the below functions seems not to be standard winapi functions */
|
||||
char buffer[PATH_MAX];
|
||||
time_t curtime;
|
||||
struct tm *loctime;
|
||||
|
||||
/* Get the current time. */
|
||||
curtime = time (NULL);
|
||||
|
||||
/* Convert it to local time representation. */
|
||||
loctime = localtime (&curtime);
|
||||
|
||||
strftime (buffer, sizeof(buffer), filename, loctime);
|
||||
filename = buffer;
|
||||
#endif
|
||||
|
||||
return fopen (filename, "ab");
|
||||
}
|
||||
|
||||
/* Perform any initialisation just before the stream data is processed, the header
|
||||
* info is processed by now and the format details are setup
|
||||
*/
|
||||
@ -614,7 +637,7 @@ static void source_init (source_t *source)
|
||||
|
||||
if (source->dumpfilename != NULL)
|
||||
{
|
||||
source->dumpfile = fopen (source->dumpfilename, "ab");
|
||||
source->dumpfile = source_open_dumpfile (source->dumpfilename);
|
||||
if (source->dumpfile == NULL)
|
||||
{
|
||||
WARN2("Cannot open dump file \"%s\" for appending: %s, disabling.",
|
||||
|
Loading…
Reference in New Issue
Block a user