Page MenuHomeFreeBSD

D21153.diff
No OneTemporary

D21153.diff

Index: lib/libc/gen/auxv.3
===================================================================
--- lib/libc/gen/auxv.3
+++ lib/libc/gen/auxv.3
@@ -68,11 +68,11 @@
.Sh ERRORS
.Bl -tag -width Er
.It Bq Er EINVAL
-An unknown item was requested.
-.It Bq Er EINVAL
The provided buffer was not the right size for the requested item.
.It Bq Er ENOENT
The requested item is not available.
+.It Bq Er ENOENT
+An unknown item was requested.
.El
.Sh HISTORY
The
Index: lib/libc/gen/auxv.c
===================================================================
--- lib/libc/gen/auxv.c
+++ lib/libc/gen/auxv.c
@@ -140,27 +140,36 @@
switch (aux) {
case AT_CANARY:
- if (canary != NULL && canary_len >= buflen) {
- memcpy(buf, canary, buflen);
- memset(canary, 0, canary_len);
- canary = NULL;
- res = 0;
+ if (canary_len >= buflen) {
+ if (canary != NULL) {
+ memcpy(buf, canary, buflen);
+ memset(canary, 0, canary_len);
+ canary = NULL;
+ res = 0;
+ } else
+ res = ENOENT;
} else
- res = ENOENT;
+ res = EINVAL;
break;
case AT_HWCAP:
- if (hwcap_present && buflen == sizeof(u_long)) {
- *(u_long *)buf = hwcap;
- res = 0;
+ if (buflen == sizeof(u_long)) {
+ if (hwcap_present) {
+ *(u_long *)buf = hwcap;
+ res = 0;
+ } else
+ res = ENOENT;
} else
- res = ENOENT;
+ res = EINVAL;
break;
case AT_HWCAP2:
- if (hwcap2_present && buflen == sizeof(u_long)) {
- *(u_long *)buf = hwcap2;
- res = 0;
+ if (buflen == sizeof(u_long)) {
+ if (hwcap2_present) {
+ *(u_long *)buf = hwcap2;
+ res = 0;
+ } else
+ res = ENOENT;
} else
- res = ENOENT;
+ res = EINVAL;
break;
case AT_NCPUS:
if (buflen == sizeof(int)) {
@@ -173,11 +182,14 @@
res = EINVAL;
break;
case AT_PAGESIZES:
- if (pagesizes != NULL && pagesizes_len >= buflen) {
- memcpy(buf, pagesizes, buflen);
- res = 0;
+ if (pagesizes_len >= buflen) {
+ if (pagesizes != NULL) {
+ memcpy(buf, pagesizes, buflen);
+ res = 0;
+ } else
+ res = ENOENT;
} else
- res = ENOENT;
+ res = EINVAL;
break;
case AT_PAGESZ:
if (buflen == sizeof(int)) {

File Metadata

Mime Type
text/plain
Expires
Sat, Aug 22, 7:35 AM (20 m, 47 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37068336
Default Alt Text
D21153.diff (2 KB)

Event Timeline