diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2016-01-24 15:55:07 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2016-01-24 16:12:13 +0900 |
commit | 2f1acf6f1321e00c8e48ca8f161c4d7883ffad63 (patch) | |
tree | 371e197631b37be601757a537f356be606f41ef5 /src | |
parent | e6b6225e3b7f897fe30acc57bfbe82af1c8514fd (diff) |
journal-remote: fix broken --getter option
This commit fixes the following broken --getter option:
when systemd-journal-remote is called with --getter option,
it causes the error meesage "Zero sources specified" and
the getter command will not be called.
Diffstat (limited to 'src')
-rw-r--r-- | src/journal-remote/journal-remote.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index 68237be643..04bca11277 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -150,7 +150,7 @@ static int spawn_curl(const char* url) { return r; } -static int spawn_getter(const char *getter, const char *url) { +static int spawn_getter(const char *getter) { int r; _cleanup_strv_free_ char **words = NULL; @@ -159,10 +159,6 @@ static int spawn_getter(const char *getter, const char *url) { if (r < 0) return log_error_errno(r, "Failed to split getter option: %m"); - r = strv_extend(&words, url); - if (r < 0) - return log_error_errno(r, "Failed to create command line: %m"); - r = spawn_child(words[0], words); if (r < 0) log_error_errno(r, "Failed to spawn getter %s: %m", getter); @@ -897,6 +893,17 @@ static int remoteserver_init(RemoteServer *s, fd); } + if (arg_getter) { + log_info("Spawning getter %s...", arg_getter); + fd = spawn_getter(arg_getter); + if (fd < 0) + return fd; + + r = add_source(s, fd, (char*) arg_output, false); + if (r < 0) + return r; + } + if (arg_url) { const char *url; char *hostname, *p; @@ -910,13 +917,8 @@ static int remoteserver_init(RemoteServer *s, else url = strdupa(arg_url); - if (arg_getter) { - log_info("Spawning getter %s...", url); - fd = spawn_getter(arg_getter, url); - } else { - log_info("Spawning curl %s...", url); - fd = spawn_curl(url); - } + log_info("Spawning curl %s...", url); + fd = spawn_curl(url); if (fd < 0) return fd; |