OpenBSD: explicitely define nitems

nitems is never guaranteed to be defined in sys/params.h as it is meant
to be defined within a protected ifdef __KERNEL condition.
This commit is contained in:
Antoine Jacoutot 2012-07-08 19:23:18 +02:00
parent a511a706de
commit f9a6a97470

View File

@ -1681,6 +1681,10 @@ platform_get_argv0 (void)
cmdline = (char **) realloc (cmdline, len);
#ifndef nitems
#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
#endif
if (sysctl (mib, nitems (mib), cmdline, &len, NULL, 0) == -1)
{
g_free (cmdline);