ObjFW  Check-in [591d1c6c2b]

Overview
Comment:OFDNSResolverSettings: Use HOST_NAME_MAX
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 591d1c6c2bc7869ebf2f8bbfa6b787bbf94d9862e804633090e3ad4929e1567c
User & Date: js on 2022-07-17 13:57:55
Other Links: manifest | tags
Context
2022-07-31
13:16
OFTimer: Include objects in description check-in: 25e07aba82 user: js tags: trunk
2022-07-17
16:58
configure: Add Nintendo Switch check-in: c4419f085b user: js tags: nintendo-switch
13:57
OFDNSResolverSettings: Use HOST_NAME_MAX check-in: 591d1c6c2b user: js tags: trunk
2022-07-16
18:38
OFOpenSSLTLSStream: Make compatible with LibreSSL check-in: c765e8d058 user: js tags: trunk
Changes

Modified src/OFDNSResolverSettings.m from [94502fce5f] to [a43cd003ad].

62
63
64
65
66
67
68




69
70
71
72
73
74
75
#elif defined(OF_AMIGAOS)
# define HOSTS_PATH @"AmiTCP:db/hosts"
# define RESOLV_CONF_PATH @"AmiTCP:db/resolv.conf"
#else
# define HOSTS_PATH @"/etc/hosts"
# define RESOLV_CONF_PATH @"/etc/resolv.conf"
#endif





#ifndef OF_WII
static OFString *
domainFromHostname(OFString *hostname)
{
	OFString *ret;








>
>
>
>







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#elif defined(OF_AMIGAOS)
# define HOSTS_PATH @"AmiTCP:db/hosts"
# define RESOLV_CONF_PATH @"AmiTCP:db/resolv.conf"
#else
# define HOSTS_PATH @"/etc/hosts"
# define RESOLV_CONF_PATH @"/etc/resolv.conf"
#endif

#ifndef HOST_NAME_MAX
# define HOST_NAME_MAX 255
#endif

#ifndef OF_WII
static OFString *
domainFromHostname(OFString *hostname)
{
	OFString *ret;

98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
}
#endif

#if !defined(OF_WII) && !defined(OF_MORPHOS)
static OFString *
obtainHostname(void)
{
	char hostname[256];

	if (gethostname(hostname, 256) != 0)
		return nil;

	return [OFString stringWithCString: hostname
				  encoding: [OFLocale encoding]];
}
#endif








|

|







102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
}
#endif

#if !defined(OF_WII) && !defined(OF_MORPHOS)
static OFString *
obtainHostname(void)
{
	char hostname[HOST_NAME_MAX + 1];

	if (gethostname(hostname, HOST_NAME_MAX + 1) != 0)
		return nil;

	return [OFString stringWithCString: hostname
				  encoding: [OFLocale encoding]];
}
#endif