ObjFW  Check-in [12e54c754f]

Overview
Comment:OFSystemInfo: Check uname() return against -1

Some systems return a positive value, making it look like it failed when
it succeeded when checking != 0.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 12e54c754f72a98b42c0ef26ade57afac57a1eaad061b9fd6f43e09e696a188e
User & Date: js on 2023-10-01 20:23:52
Other Links: manifest | tags
Context
2023-10-02
22:38
README.md: Remove paragraph about opening the repo check-in: 0dc8f1b5cd user: js tags: trunk
2023-10-01
20:23
OFSystemInfo: Check uname() return against -1 check-in: 12e54c754f user: js tags: trunk
11:24
README.md: Add instructions for OpenIndiana check-in: 9e1d2db0eb user: js tags: trunk
Changes

Modified src/OFSystemInfo.m from [0621210a4b] to [2ae1048a93].

156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#elif defined(OF_DJGPP)
	operatingSystemName = [[OFString alloc]
	    initWithCString: _os_flavor
		   encoding: OFStringEncodingASCII];
#elif defined(HAVE_SYS_UTSNAME_H) && defined(HAVE_UNAME)
	struct utsname name;

	if (uname(&name) != 0)
		return;

	operatingSystemName = [[OFString alloc]
	    initWithCString: name.sysname
		   encoding: [OFLocale encoding]];
#endif
}







|







156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#elif defined(OF_DJGPP)
	operatingSystemName = [[OFString alloc]
	    initWithCString: _os_flavor
		   encoding: OFStringEncodingASCII];
#elif defined(HAVE_SYS_UTSNAME_H) && defined(HAVE_UNAME)
	struct utsname name;

	if (uname(&name) == -1)
		return;

	operatingSystemName = [[OFString alloc]
	    initWithCString: name.sysname
		   encoding: [OFLocale encoding]];
#endif
}
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
	    initWithFormat: @"%u.%u", _osmajor, _osminor];
#elif defined(OF_WII) || defined(NINTENDO_3DS) || defined(OF_NINTENDO_DS) || \
    defined(OF_PSP)
	/* Intentionally nothing */
#elif defined(HAVE_SYS_UTSNAME_H) && defined(HAVE_UNAME)
	struct utsname name;

	if (uname(&name) != 0)
		return;

	operatingSystemVersion = [[OFString alloc]
	    initWithCString: name.release
		   encoding: [OFLocale encoding]];
#endif
}







|







253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
	    initWithFormat: @"%u.%u", _osmajor, _osminor];
#elif defined(OF_WII) || defined(NINTENDO_3DS) || defined(OF_NINTENDO_DS) || \
    defined(OF_PSP)
	/* Intentionally nothing */
#elif defined(HAVE_SYS_UTSNAME_H) && defined(HAVE_UNAME)
	struct utsname name;

	if (uname(&name) == -1)
		return;

	operatingSystemVersion = [[OFString alloc]
	    initWithCString: name.release
		   encoding: [OFLocale encoding]];
#endif
}