output/srzip: Use sr_output->filename instead of option

This fixes parts of bug #570.
This commit is contained in:
Soeren Apel 2015-07-30 07:29:11 +02:00 committed by Uwe Hermann
parent 81b3ce374c
commit 37875f7506
1 changed files with 7 additions and 3 deletions

View File

@ -39,11 +39,16 @@ static int init(struct sr_output *o, GHashTable *options)
{ {
struct out_context *outc; struct out_context *outc;
(void)options;
outc = g_malloc0(sizeof(struct out_context)); outc = g_malloc0(sizeof(struct out_context));
o->priv = outc; o->priv = outc;
outc->filename = g_strdup(g_variant_get_string(g_hash_table_lookup(options, "filename"), NULL));
if (strlen(outc->filename) == 0) if (strlen(o->filename) == 0) {
sr_info("srzip output module requires a file name, cannot save.");
return SR_ERR_ARG; return SR_ERR_ARG;
}
outc->filename = g_strdup(o->filename);
return SR_OK; return SR_OK;
} }
@ -296,7 +301,6 @@ static int cleanup(struct sr_output *o)
} }
static struct sr_option options[] = { static struct sr_option options[] = {
{ "filename", "Filename", "File to write", NULL, NULL },
ALL_ZERO ALL_ZERO
}; };