diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-11-23 16:30:23 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-11-26 14:08:46 +0100 |
commit | 49fe5c099639aa2111efb56c6ac609955a279279 (patch) | |
tree | bff451fbe68b0aa57fe8ad198695384eab264545 /src/journal-remote | |
parent | 52f1552073047195d51901f7e5a5a4fa3189034e (diff) | |
download | systemd-49fe5c099639aa2111efb56c6ac609955a279279.tar.gz systemd-49fe5c099639aa2111efb56c6ac609955a279279.tar.bz2 systemd-49fe5c099639aa2111efb56c6ac609955a279279.zip |
tree-wide: port various places over to STARTSWITH_SET()
Diffstat (limited to 'src/journal-remote')
-rw-r--r-- | src/journal-remote/journal-remote-main.c | 7 | ||||
-rw-r--r-- | src/journal-remote/journal-upload.c | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c index 44f3450d87..02078dcb4a 100644 --- a/src/journal-remote/journal-remote-main.c +++ b/src/journal-remote/journal-remote-main.c @@ -630,10 +630,9 @@ static int create_remoteserver( if (fd < 0) return fd; - hostname = - startswith(arg_url, "https://") ?: - startswith(arg_url, "http://") ?: - arg_url; + hostname = STARTSWITH_SET(arg_url, "https://", "http://"); + if (!hostname) + hostname = arg_url; hostname = strdupa(hostname); if ((p = strchr(hostname, '/'))) diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c index f7b91fddde..70d0fcad4d 100644 --- a/src/journal-remote/journal-upload.c +++ b/src/journal-remote/journal-upload.c @@ -25,6 +25,7 @@ #include "sigbus.h" #include "signal-util.h" #include "string-util.h" +#include "strv.h" #include "util.h" #define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-upload.pem" @@ -408,7 +409,8 @@ static int setup_uploader(Uploader *u, const char *url, const char *state_file) memzero(u, sizeof(Uploader)); u->input = -1; - if (!(host = startswith(url, "http://")) && !(host = startswith(url, "https://"))) { + host = STARTSWITH_SET(url, "http://", "https://"); + if (!host) { host = url; proto = "https://"; } |