diff --git a/libc/private/KernelArgumentBlock.h b/libc/private/KernelArgumentBlock.h index c8ea4977a..68d499999 100644 --- a/libc/private/KernelArgumentBlock.h +++ b/libc/private/KernelArgumentBlock.h @@ -38,32 +38,25 @@ class KernelArgumentBlock { argv = reinterpret_cast(args + 1); envp = argv + argc + 1; - // Skip over all environment variable definitions to find aux vector. - // The end of the environment block is marked by two NULL pointers. + // Skip over all environment variable definitions to find the aux vector. + // The end of the environment block is marked by a NULL pointer. char** p = envp; while (*p != NULL) { ++p; } - ++p; // Skip second NULL; + ++p; // Skip the NULL itself. auxv = reinterpret_cast(p); } // Similar to ::getauxval but doesn't require the libc global variables to be set up, - // so it's safe to call this really early on. This function also lets you distinguish - // between the inability to find the given type and its value just happening to be 0. - unsigned long getauxval(unsigned long type, bool* found_match = NULL) { + // so it's safe to call this really early on. + unsigned long getauxval(unsigned long type) { for (ElfW(auxv_t)* v = auxv; v->a_type != AT_NULL; ++v) { if (v->a_type == type) { - if (found_match != NULL) { - *found_match = true; - } return v->a_un.a_val; } } - if (found_match != NULL) { - *found_match = false; - } return 0; }