mirror of git://git.sysmocom.de/ofono
main: Make -d option repeatable
Concatenating the patterns makes more sense than using the last supplied value and leaking the previous allocated patterns.
This commit is contained in:
parent
3079ccad45
commit
54fb56df24
17
src/main.c
17
src/main.c
|
@ -137,10 +137,19 @@ static gboolean option_version = FALSE;
|
|||
static gboolean parse_debug(const char *key, const char *value,
|
||||
gpointer user_data, GError **error)
|
||||
{
|
||||
if (value)
|
||||
option_debug = g_strdup(value);
|
||||
else
|
||||
if (value) {
|
||||
if (option_debug) {
|
||||
char *prev = option_debug;
|
||||
|
||||
option_debug = g_strconcat(prev, ",", value, NULL);
|
||||
g_free(prev);
|
||||
} else {
|
||||
option_debug = g_strdup(value);
|
||||
}
|
||||
} else {
|
||||
g_free(option_debug);
|
||||
option_debug = g_strdup("*");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -262,5 +271,7 @@ cleanup:
|
|||
|
||||
__ofono_log_cleanup();
|
||||
|
||||
g_free(option_debug);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue