Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/gen Be consistent about returning -1 on error. Don'...
details: https://anonhg.NetBSD.org/src/rev/7bc31aa01d40
branches: trunk
changeset: 348016:7bc31aa01d40
user: dholland <dholland%NetBSD.org@localhost>
date: Fri Sep 30 06:16:47 2016 +0000
description:
Be consistent about returning -1 on error. Don't return random errnos
instead.
diffstat:
lib/libc/gen/sysctlgetmibinfo.c | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)
diffs (52 lines):
diff -r eb870f0d6e75 -r 7bc31aa01d40 lib/libc/gen/sysctlgetmibinfo.c
--- a/lib/libc/gen/sysctlgetmibinfo.c Thu Sep 29 21:46:32 2016 +0000
+++ b/lib/libc/gen/sysctlgetmibinfo.c Fri Sep 30 06:16:47 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysctlgetmibinfo.c,v 1.11 2014/05/16 12:22:32 martin Exp $ */
+/* $NetBSD: sysctlgetmibinfo.c,v 1.12 2016/09/30 06:16:47 dholland Exp $ */
/*-
* Copyright (c) 2003,2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: sysctlgetmibinfo.c,v 1.11 2014/05/16 12:22:32 martin Exp $");
+__RCSID("$NetBSD: sysctlgetmibinfo.c,v 1.12 2016/09/30 06:16:47 dholland Exp $");
#endif /* LIBC_SCCS and not lint */
#ifndef RUMP_ACTION
@@ -421,20 +421,27 @@
if (rnode != NULL) {
if (*rnode == NULL) {
/* XXX later deal with dealing back a sub version */
- if (v != SYSCTL_VERSION)
- return (EINVAL);
+ if (v != SYSCTL_VERSION) {
+ errno = EINVAL;
+ return -1;
+ }
pnode = &sysctl_mibroot;
}
else {
/* this is just someone being silly */
- if (SYSCTL_VERS((*rnode)->sysctl_flags) != (uint32_t)v)
- return (EINVAL);
+ if (SYSCTL_VERS((*rnode)->sysctl_flags)
+ != (uint32_t)v) {
+ errno = EINVAL;
+ return -1;
+ }
/* XXX later deal with other people's trees */
if (SYSCTL_VERS((*rnode)->sysctl_flags) !=
- SYSCTL_VERSION)
- return (EINVAL);
+ SYSCTL_VERSION) {
+ errno = EINVAL;
+ return -1;
+ }
pnode = *rnode;
}
Home |
Main Index |
Thread Index |
Old Index