aboutsummaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authorshtrophic <christoph@liebender.dev>2025-01-24 22:24:05 +0100
committershtrophic <christoph@liebender.dev>2025-01-24 22:24:05 +0100
commit3d96c576287736ebdf87e4a7b956842a6c6e055f (patch)
treead5f4cc5ebc9913ccfd753edfc934b82e34be72e /utils.c
parent1c4c15540360a5db9d56e6ae8d206a1f30a4f52b (diff)
enforce tls when supported && add tests
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/utils.c b/utils.c
index faf6d12..dbf798a 100644
--- a/utils.c
+++ b/utils.c
@@ -931,6 +931,7 @@ int parse_port(const char *url, const char **errstr)
if (!(col = strchr(url, ':'))) {
if (errstr)
*errstr = "bad url";
+
return -1;
}
@@ -950,13 +951,17 @@ int parse_port(const char *url, const char **errstr)
if (ret != -1)
return ret;
- *errstr = strerror(errno);
+ if (errstr)
+ *errstr = strerror(errno);
+
return -1;
}
return tmp;
}
- *errstr = "unknown protocol";
+ if (errstr)
+ *errstr = "unknown protocol";
+
return -1;
}