summary refs log tree commit diff
path: root/irc.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-08-21 16:47:54 -0400
committerJune McEnroe <june@causal.agency>2020-08-21 16:49:10 -0400
commit8190d76086e57a4b07e7ed39af3748a470f53b89 (patch)
tree36f030d39046cea3a6575b69d7a8721bc71dccae /irc.c
parentDocument how cert/priv are searched for (diff)
downloadcatgirl-8190d76086e57a4b07e7ed39af3748a470f53b89.tar.gz
catgirl-8190d76086e57a4b07e7ed39af3748a470f53b89.zip
Use a static buffer for base directory paths
Diffstat (limited to '')
-rw-r--r--irc.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/irc.c b/irc.c
index b87351c..5acc69f 100644
--- a/irc.c
+++ b/irc.c
@@ -27,7 +27,6 @@
 
 #include <assert.h>
 #include <err.h>
-#include <limits.h>
 #include <netdb.h>
 #include <netinet/in.h>
 #include <stdarg.h>
@@ -61,12 +60,9 @@ void ircConfig(bool insecure, const char *cert, const char *priv) {
 		tls_config_insecure_noverifyname(config);
 	}
 
-	const char *path;
-	const char *dirs;
-	char buf[PATH_MAX];
 	if (cert) {
-		dirs = NULL;
-		while (NULL != (path = configPath(buf, sizeof(buf), &dirs, cert))) {
+		const char *dirs = NULL;
+		for (const char *path; NULL != (path = configPath(&dirs, cert));) {
 			if (priv) {
 				error = tls_config_set_cert_file(config, path);
 			} else {
@@ -77,8 +73,8 @@ void ircConfig(bool insecure, const char *cert, const char *priv) {
 		if (error) errx(EX_NOINPUT, "%s: %s", cert, tls_config_error(config));
 	}
 	if (priv) {
-		dirs = NULL;
-		while (NULL != (path = configPath(buf, sizeof(buf), &dirs, priv))) {
+		const char *dirs = NULL;
+		for (const char *path; NULL != (path = configPath(&dirs, priv));) {
 			error = tls_config_set_key_file(config, path);
 			if (!error) break;
 		}