Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-kde
Path: blob/main/comms/aprsd/files/patch-src_queryResp.cpp
16461 views
1
--- src/queryResp.cpp.orig 2003-03-31 04:49:40 UTC
2
+++ src/queryResp.cpp
3
@@ -40,6 +40,9 @@
4
5
#include <netinet/in.h>
6
#include <arpa/inet.h>
7
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
8
+#include <sys/param.h>
9
+#endif
10
11
#include "constant.h"
12
#include "utils.h"
13
@@ -84,7 +87,6 @@ void queryResp(int source, const aprsString* pkt)
14
if ((rc = gethostname(hostname,80)) != 0)
15
strcpy(hostname, "Host_Unknown");
16
else {
17
-
18
//Thread-Safe verison of gethostbyname()
19
h = NULL;
20
rc = gethostbyname_r(hostname,
21
@@ -94,12 +96,10 @@ void queryResp(int source, const aprsString* pkt)
22
&h,
23
&h_err);
24
25
-
26
-
27
if ((rc == 0) && (h!= NULL)) {
28
strncpy(hostname,h->h_name,80); //Copy Full host name
29
hostname[79] = '\0'; //Be sure it's terminated
30
- strncpy((char*)hip,h->h_addr_list[0],4); //Copy Host IP
31
+ memcpy((void*)hip,(void*)h->h_addr_list[0],4); //Copy Host IP
32
}
33
}
34
35
36