summaryrefslogtreecommitdiffstats
path: root/net/addrwatch/patches/002-fix-uclibc-sysconf.patch
blob: 6d7b712c871c278b88fb025400737f6b583df804 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
From 951b6940f4cf14a4a1712e9b874e3a9c5e32befc Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Sun, 8 Mar 2020 03:44:53 -0700
Subject: [PATCH] Use compile-time macro HOST_NAME_MAX instead of run-time via
 sysconf

This seems to be more portable for non-standard libcs.
---
 src/addrwatch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/src/addrwatch.c
+++ b/src/addrwatch.c
@@ -501,7 +501,7 @@ int main(int argc, char *argv[])
 	argp_parse(&argp, argc, argv, 0, &optind, 0);
 
 	if (!cfg.hostname) {
-		cfg.hostname_len = sysconf(_SC_HOST_NAME_MAX);
+		cfg.hostname_len = HOST_NAME_MAX;
 		cfg.hostname = (char *)calloc(cfg.hostname_len, sizeof(char));
 		gethostname(cfg.hostname, cfg.hostname_len);
 	}