summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2006-12-04 15:02:26 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2006-12-04 15:02:26 +0000
commitb5af6deedd783c955c9695acbeddeef0db01ddbe (patch)
treef6809eab15ba80e6f16f02b73d4f75be840ab0b6
parent6961c0f1d598184fe794e20b8ad22a9b949e5edf (diff)
confstr() should return 0, not (size_t)-1, on errors; from Guy Harris.
ok millert@ and jmc@ for the man page bit.
-rw-r--r--lib/libc/gen/confstr.34
-rw-r--r--lib/libc/gen/confstr.c8
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/libc/gen/confstr.3 b/lib/libc/gen/confstr.3
index 260cfe7b445..e5d552e7e93 100644
--- a/lib/libc/gen/confstr.3
+++ b/lib/libc/gen/confstr.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: confstr.3,v 1.14 2005/02/25 03:12:43 cloder Exp $
+.\" $OpenBSD: confstr.3,v 1.15 2006/12/04 15:02:25 otto Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@@ -80,7 +80,7 @@ environment variable that finds all the standard utilities.
.Sh RETURN VALUES
If the call to
.Nm
-is not successful, \-1 is returned and
+is not successful, 0 is returned and
.Va errno
is set appropriately.
Otherwise, if the variable does not have a configuration defined value,
diff --git a/lib/libc/gen/confstr.c b/lib/libc/gen/confstr.c
index 7a3c1755a18..57ddf720664 100644
--- a/lib/libc/gen/confstr.c
+++ b/lib/libc/gen/confstr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: confstr.c,v 1.7 2005/08/08 08:05:33 espie Exp $ */
+/* $OpenBSD: confstr.c,v 1.8 2006/12/04 15:02:25 otto Exp $ */
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
@@ -49,15 +49,15 @@ confstr(int name, char *buf, size_t len)
mib[0] = CTL_USER;
mib[1] = USER_CS_PATH;
if (sysctl(mib, 2, NULL, &tlen, NULL, 0) == -1)
- return ((size_t) -1);
+ return (0);
if (len != 0 && buf != NULL) {
if ((p = malloc(tlen)) == NULL)
- return ((size_t) -1);
+ return (0);
if (sysctl(mib, 2, p, &tlen, NULL, 0) == -1) {
sverrno = errno;
free(p);
errno = sverrno;
- return ((size_t) -1);
+ return (0);
}
/*
* POSIX 1003.2 requires partial return of