summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2009-06-05 17:19:00 +0000
committerschwarze <schwarze@openbsd.org>2009-06-05 17:19:00 +0000
commit2f7e579f75e4d28b754caf6d525e84c632f9028d (patch)
tree2e3c47d9c0a27f327c1b53eb9deb5142b1ee5e00 /lib/libc
parentWhen parsing a line stating with "+" or "-" in group(5), (diff)
downloadwireguard-openbsd-2f7e579f75e4d28b754caf6d525e84c632f9028d.tar.xz
wireguard-openbsd-2f7e579f75e4d28b754caf6d525e84c632f9028d.zip
improve yp_bind(3) error reporting after clnttcp_create(3) failure:
map ECONNREFUSED -> YPERR_YPBIND, ENOMEM -> YPERR_RESRC, else YPERR_YPERR while here, malloc(3) failure should raise YPERR_RESRC, not YPERR_YPERR ok millert@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/yp/yp_bind.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/libc/yp/yp_bind.c b/lib/libc/yp/yp_bind.c
index fa8fa63531d..80197adb674 100644
--- a/lib/libc/yp/yp_bind.c
+++ b/lib/libc/yp/yp_bind.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: yp_bind.c,v 1.16 2007/09/17 07:07:23 moritz Exp $ */
+/* $OpenBSD: yp_bind.c,v 1.17 2009/06/05 17:19:00 schwarze Exp $ */
/*
* Copyright (c) 1992, 1993, 1996 Theo de Raadt <deraadt@theos.com>
* All rights reserved.
@@ -98,7 +98,7 @@ _yp_dobind(const char *dom, struct dom_binding **ypdb)
break;
if (ysd == NULL) {
if ((ysd = malloc(sizeof *ysd)) == NULL)
- return YPERR_YPERR;
+ return YPERR_RESRC;
(void)memset(ysd, 0, sizeof *ysd);
ysd->dom_socket = -1;
ysd->dom_vers = 0;
@@ -164,7 +164,14 @@ trynet:
clnt_pcreateerror("clnttcp_create");
if (new)
free(ysd);
- return YPERR_YPBIND;
+ switch (rpc_createerr.cf_error.re_errno) {
+ case ECONNREFUSED:
+ return YPERR_YPBIND;
+ case ENOMEM:
+ return YPERR_RESRC;
+ default:
+ return YPERR_YPERR;
+ }
}
if (ntohs(clnt_sin.sin_port) >= IPPORT_RESERVED ||
ntohs(clnt_sin.sin_port) == 20) {