diff options
author | Slava Monich <slava.monich@jolla.com> | 2016-10-04 12:51:54 +0300 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2016-10-04 22:26:26 -0500 |
commit | 54fb56df2413c960d1b73b83e2f1ae2392f21226 (patch) | |
tree | 8eadece4399f9182bbeb84582d3b71fa0b5a68d2 | |
parent | 3079ccad458c5f676111535aa2c25d9a5d6d2af6 (diff) | |
download | ofono-54fb56df2413c960d1b73b83e2f1ae2392f21226.tar.gz |
main: Make -d option repeatable
Concatenating the patterns makes more sense than using the last
supplied value and leaking the previous allocated patterns.
-rw-r--r-- | src/main.c | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -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; } |